Last active
April 6, 2017 05:01
-
-
Save alex35mil/c39422958470d9f0e88793a23eddd9c2 to your computer and use it in GitHub Desktop.
This file contains 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
import createIcon from '.utils/createIcon'; | |
import colors from './styles/colors'; | |
const MyIcon = ({ color }) => ( | |
<path fill={colors[color]} ... /> | |
); | |
export default createIcon({ | |
width: 16, | |
height: 16, | |
Icon: MyIcon, | |
}); |
This file contains 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
import SvgIconTemplate from 'libs/templates/SvgIconTemplate'; | |
export default ({ width, height, Icon }) => { | |
const WrappedIcon = ({ | |
color, | |
title = Icon.name, | |
viewBoxWidth = width, | |
viewBoxHeight = height, | |
...otherProps | |
}) => ( | |
<SvgIconTemplate {...{ title, viewBoxWidth, viewBoxHeight, ...otherProps }}> | |
<Icon {...{ color }} /> | |
</SvgIconTemplate> | |
); | |
WrappedIcon.aspectRatio = width / height; | |
return WrappedIcon; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment