react-toolbox/components/font_icon/index.jsx

34 lines
677 B
React
Raw Normal View History

2015-09-19 18:53:31 +03:00
/* global React */
import { addons } from 'react/addons';
import style from './style';
2015-10-04 16:42:13 +03:00
export default React.createClass({
2015-09-19 18:53:31 +03:00
mixins: [addons.PureRenderMixin],
displayName: 'FontIcon',
propTypes: {
className: React.PropTypes.string,
value: React.PropTypes.string
},
getDefaultProps () {
return {
className: ''
};
},
onClick (event) {
if (this.props.onClick) {
this.props.onClick(event);
}
},
render () {
2015-10-04 16:42:13 +03:00
let className = style[this.props.value];
if (this.props.className) className += ` ${this.props.className}`;
return <span data-toolbox='icon' className={className} onClick={this.props.onClick} />;
2015-09-19 18:53:31 +03:00
}
});