UNPKG

react-zeanium-ui-ui

Version:

Zeanium UI Framework for React.js

44 lines (40 loc) 856 B
var React = require('react'); module.exports = React.createClass({ displayName:'Icon', getDefaultProps: function (){ return { title: '', className: '', spin: false, icon: 'fa-code' } }, getInitialState: function (){ return { spin: this.props.spin || false, icon: this.props.icon || 'default' } }, componentDidMount:function(){ }, setIcon: function (){ }, spin: function () { this.setState({ spin: true }); }, unspin: function () { this.setState({ spin: false }); }, __onClick: function (event){ this.props.onClick && this.props.onClick(event, this); }, render:function(){ return ( <i title={this.props.title} className={"rt-icon fa " + this.state.icon + ' ' + (this.state.spin?'icon-spin':'') + ' ' + this.props.className} style={this.props.style} onClick={this.__onClick}></i> ); } });