Skip to content

Commit

Permalink
feat: Accept size prop for feather icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 11, 2020
1 parent 7505183 commit df680e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/FeatherIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import PropTypes from 'prop-types';
import cx from 'classnames';
import styles from './FeatherIcon.module.scss';

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

return paths ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
className={cx(styles.icon, className)}
style={{ width: size, height: size }}
>
{paths}
</svg>
Expand All @@ -28,7 +29,8 @@ const ICONS = {

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

export default FeatherIcon;
2 changes: 0 additions & 2 deletions src/components/FeatherIcon.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
width: 1em;
height: 1em;
}

0 comments on commit df680e2

Please sign in to comment.