Skip to content

Instantly share code, notes, and snippets.

@nelix
Created September 17, 2014 03:38
Show Gist options
  • Save nelix/2f0ae4744ef925c19ebf to your computer and use it in GitHub Desktop.
Save nelix/2f0ae4744ef925c19ebf to your computer and use it in GitHub Desktop.
/**
* @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