Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Last active August 10, 2022 03:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidgilbertson/efd688929a0b07945f9b3b7c835bcb0e to your computer and use it in GitHub Desktop.
Save davidgilbertson/efd688929a0b07945f9b3b7c835bcb0e to your computer and use it in GitHub Desktop.
Production version
import React from 'react';
const {PropTypes} = React;
const Icon = props => {
const styles = {
svg: {
display: 'inline-block',
verticalAlign: 'middle',
},
path: {
fill: props.color,
},
};
return (
<svg
style={styles.svg}
width={`${props.size}px`}
height={`${props.size}px`}
viewBox="0 0 1024 1024"
>
<path
style={styles.path}
d={props.icon}
></path>
</svg>
);
};
Icon.propTypes = {
icon: PropTypes.string.isRequired,
size: PropTypes.number,
color: PropTypes.string,
};
Icon.defaultProps = {
size: 16,
};
export default Icon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment