Skip to content

Instantly share code, notes, and snippets.

@geta6
Created August 13, 2015 03:42
Show Gist options
  • Select an option

  • Save geta6/07ad8ef49543dfa24ae6 to your computer and use it in GitHub Desktop.

Select an option

Save geta6/07ad8ef49543dfa24ae6 to your computer and use it in GitHub Desktop.
'use strict';
const React = require('react');
module.exports = React.createClass({
displayName: 'IconComponent',
propTypes: {
glyph: React.PropTypes.string.isRequired,
active: React.PropTypes.bool
},
getDefaultProps() {
return {active: false};
},
render() {
let glyph = `${this.props.glyph}${this.props.active ? '-active' : ''}`;
return <i className={`s s-${glyph}`} />;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment