Update prop names and prop processing logic in Icon

This commit is contained in:
Alex Liebowitz 2017-01-09 04:09:20 -05:00
parent 18192cd93b
commit 80272ab8f0

View file

@ -5,14 +5,15 @@ import $clamp from 'clamp';
//component/icon.js
export let Icon = React.createClass({
propTypes: {
style: React.PropTypes.object,
fixed: React.PropTypes.bool,
icon: React.PropTypes.string.isRequired,
className: React.PropTypes.string,
fixed: React.PropTypes.bool,
},
render: function() {
var className = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') + this.props.icon + ' ' +
(this.props.className || ''));
return <span className={className} style={this.props.style}></span>
const {fixed, className, ...other} = this.props;
const spanClassName = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') +
this.props.icon + ' ' + (this.props.className || ''));
return <span className={spanClassName} {... other}></span>
}
});