react-toolbox/components/font_icon/FontIcon.js

30 lines
621 B
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react';
2016-05-16 15:18:53 +03:00
import classnames from 'classnames';
2015-11-23 01:41:00 +03:00
2016-05-16 15:18:53 +03:00
const FontIcon = ({ children, className, value, ...other}) => (
<span
data-react-toolbox='font-icon'
className={classnames({'material-icons': typeof value === 'string' || typeof children === 'string'}, className)}
2016-05-16 15:18:53 +03:00
{...other}
>
{value}
{children}
</span>
);
2015-09-19 18:53:31 +03:00
FontIcon.propTypes = {
children: PropTypes.any,
className: PropTypes.string,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
])
};
2015-09-19 18:53:31 +03:00
FontIcon.defaultProps = {
className: ''
};
2015-09-19 18:53:31 +03:00
export default FontIcon;
2016-05-29 20:38:06 +03:00
export { FontIcon };