Created
September 17, 2014 03:38
-
-
Save nelix/2f0ae4744ef925c19ebf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jsx React.DOM | |
*/ | |
var React = require('react/addons'); | |
var getIcon = function(name) { | |
return require('./icons/' + name.toLowerCase(name) + '.svg'); | |
}; | |
var Icon = React.createClass({ | |
componentDidMount: function() { | |
this.getDOMNode().innerHTML = getIcon(this.props.type); | |
}, | |
render: function() { | |
return this.transferPropsTo(<div className={'Icon Icon--' + this.props.type.toLowerCase()} />) | |
} | |
}); | |
module.exports = Icon; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment