Skip to content

Instantly share code, notes, and snippets.

@kof
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kof/89f42663e12d89144fd9 to your computer and use it in GitHub Desktop.
Save kof/89f42663e12d89144fd9 to your computer and use it in GitHub Desktop.
Example of a react component with jss
'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
'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