Created
March 23, 2016 00:59
-
-
Save RobAWilkinson/4c5925e05037ed24b2c6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import GridSelector from './grid-selector' | |
class Form extends React.Component | |
render() { | |
return ( | |
<GridSelector | |
options={this.state.ageGroupOptions} | |
title='Age Groups?' | |
childClass='child' | |
wrapperClass='wrapper' | |
toggleClass='toggle' | |
handleSelect={this.handleSelect} | |
/> | |
) | |
} | |
} |
This file contains hidden or 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
export default class GridSelector extends Component { | |
render() { | |
return( | |
<div> | |
{this.props.title} | |
<div className={this.props.wrapperClass}> | |
{this.props.options.map((option, index) => { | |
console.log(option); | |
return ( | |
<div | |
className={this.props.childClass + option.selected ? this.props.toggleClass : ''} | |
onClick={(e) => this.props.handleSelect(option, index)} | |
> | |
{option.label} | |
</div> | |
) | |
})} | |
</div> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment