Last active
July 29, 2016 20:49
-
-
Save liesislukas/0562ac29880656145d276cc167ce1a4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- Get SVG from https://design.google.com/icons/ | |
- Change lines 31-32 with icon's path | |
*/ | |
import React from 'react'; | |
class IconDone extends React.Component { | |
shouldComponentUpdate(nextProps, nextState) { | |
return this.props.color !== nextProps.color; | |
} | |
render() { | |
if (this.props.size < 1) { | |
return null; | |
} | |
let scale = this.props.size / 24; | |
return ( | |
<svg | |
{...this.props} | |
fill={this.props.color} | |
height={this.props.size} | |
viewBox={`0 0 ${this.props.size} ${this.props.size}`} | |
width={this.props.size} | |
xmlns="http://www.w3.org/2000/svg" | |
> | |
<g style={{transform: `scale(${scale})`}}> | |
<path d={'M0 0h24v24H0z'} fill={this.props.backgroundColor}/> | |
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/> | |
</g> | |
</svg> | |
); | |
} | |
} | |
IconDone.propTypes = { | |
color: React.PropTypes.string.isRequired, | |
backgroundColor: React.PropTypes.string.isRequired, | |
size: React.PropTypes.number.isRequired, | |
}; | |
export default IconDone; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment