Skip to content

Commit

Permalink
feat: Create a FeatherIcon component
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 11, 2020
1 parent 6417df5 commit 7505183
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/FeatherIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import styles from './FeatherIcon.module.scss';

const FeatherIcon = ({ className, name }) => {
const paths = ICONS[name];

return paths ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
className={cx(styles.icon, className)}
>
{paths}
</svg>
) : null;
};

const ICONS = {
copy: (
<>
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</>
),
};

FeatherIcon.propTypes = {
className: PropTypes.string,
name: PropTypes.oneOf(Object.keys(ICONS)),
};

export default FeatherIcon;
9 changes: 9 additions & 0 deletions src/components/FeatherIcon.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.icon {
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
width: 1em;
height: 1em;
}

0 comments on commit 7505183

Please sign in to comment.