Last active
August 29, 2015 14:14
-
-
Save kof/89f42663e12d89144fd9 to your computer and use it in GitHub Desktop.
Example of a react component with jss
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
'use strict' | |
import React from 'react' | |
import useSheet from 'react-jss' | |
import sectionStyle from './sectionStyle' | |
import Item from './Item' | |
/** | |
* One list section which has a title and list items. | |
*/ | |
var Section = React.createClass({ | |
mixins: [useSheet(sectionStyle)], | |
render() { | |
var classes = this.sheet.classes | |
var items = this.props.results.map(function (result) { | |
return <Item {...result} select={this.props.select} /> | |
}, this) | |
return ( | |
<section> | |
<header className={classes.header}>{this.props.label}</header> | |
{items} | |
</section> | |
) | |
} | |
}) | |
export default Section |
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
'use strict' | |
import colors from 'theme/base-colors' | |
import fonts from 'theme/fonts' | |
export default { | |
header: { | |
extend: fonts.small, | |
background: colors.silverDark, | |
padding: '10px 8px 4px 8px', | |
textTransform: 'uppercase', | |
color: colors.gainsboroDark | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment