react-jam-ui
Version:
React JAM UI components
37 lines (33 loc) • 806 B
JavaScript
import { default as React, PropTypes } from 'react'
const Icon = ({ children, color, size, style, ...props }, { reactIcon = {} }) => {
const computedSize = size || reactIcon.size || '1em'
return (
<svg
children={children}
fill='currentColor'
preserveAspectRatio='xMidYMid meet'
height={computedSize}
width={computedSize}
{...reactIcon}
{...props}
style={{
verticalAlign: 'middle',
color: color || reactIcon.color,
...(reactIcon.style || {}),
...style
}}
/>
)
}
Icon.propTypes = {
color: PropTypes.string,
size: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
style: PropTypes.object
}
Icon.contextTypes = {
reactIcon: PropTypes.shape(Icon.propTypes)
}
export default Icon