Created
December 28, 2014 08:11
-
-
Save petehunt/bd5fa62610f80b6ec087 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
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