Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function makeStyle(defaults, tagName) {
tagName = tagName || 'div';
var Style = React.createClass({
getDefaultProps: function() {
return assign({}, defaults);
},
render: function() {
var style = assign({}, this.props);
delete style.children;
return React.createElement(
tagName,
{style: style, children: this.props.children}
);
}
});
return Style;
}
var Emphasis = makeStyle({fontWeight: 'bold', color: 'red'});
var Subtitle = makeStyle({color: 'gray'});
var Style = makeStyle();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment