react-toolbox/components/font_icon/FontIcon.js

32 lines
700 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
const FontIcon = ({ alt, children, className, value, ...other}) => (
2016-05-16 15:18:53 +03:00
<span
data-react-toolbox='font-icon'
aria-label={alt}
className={classnames({'material-icons': typeof value === 'string' || typeof children === 'string'}, className)}
2016-05-16 15:18:53 +03:00
{...other}
>
<span aria-hidden="true">{value}</span>
2016-05-16 15:18:53 +03:00
</span>
);
2015-09-19 18:53:31 +03:00
FontIcon.propTypes = {
alt: PropTypes.string,
children: PropTypes.any,
className: PropTypes.string,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
])
};
2015-09-19 18:53:31 +03:00
FontIcon.defaultProps = {
alt: '',
className: ''
};
2015-09-19 18:53:31 +03:00
export default FontIcon;
2016-05-29 20:38:06 +03:00
export { FontIcon };