1.0.3 • Published 6 years ago

react-mutate-icon v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

ReactMutateIcon

Commitizen friendly Coverage Status Dev Dependencies Travis Greenkeeper badge npm license Donate semantic-release styled with prettier

SVG Image Mutation using React

Usage

import React from 'react';
import PropTypes from 'prop-types';
import { MutateIcon, Mutate } from 'react-mutate-icon';
import SVGIcon from './logo'; // svg component built with svgr
import * as icons from './icons'; // object with key as string and value as svg component

export const Logo = props => (
  <MutateIcon component={SVGIcon} {...props}>
    <Mutate selector="g" fill="#BADA55" />
  </MutateIcon>
);

// or with with lots of icons
export const Icon = ({ name, ...props }) => (
  <MutateIcon component={icons[name]} {...props}>
    <Mutate selector="g" fill="#BADA55" />
  </MutateIcon>
);

Icon.propTypes = {
  name: PropTypes.string
};

API

Props

MutateIcon

nametypedescription
componentReact.Elementthe icon component to mutate
*anyall other props will be merged into the component

Mutate

nametypedescription
selectorstringthe selector of the node to modify
*anyall other props that are passed will be merged into the element that matches the selector
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago