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 //component/icon.js
export let Icon = React.createClass({ export let Icon = React.createClass({
propTypes: { propTypes: {
style: React.PropTypes.object, icon: React.PropTypes.string.isRequired,
fixed: React.PropTypes.bool,
className: React.PropTypes.string, className: React.PropTypes.string,
fixed: React.PropTypes.bool,
}, },
render: function() { render: function() {
var className = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') + this.props.icon + ' ' + const {fixed, className, ...other} = this.props;
(this.props.className || '')); const spanClassName = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') +
return <span className={className} style={this.props.style}></span> this.props.icon + ' ' + (this.props.className || ''));
return <span className={spanClassName} {... other}></span>
} }
}); });