react-jam-ui
Version:
React JAM UI components
38 lines (34 loc) • 830 B
JavaScript
import { default as React } from 'react'
import PropTypes from 'prop-types'
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