Sha256: b6f7e776fc33ec26146cd11e034c9dc97425fa4a7f31b7b2d83aeca2de7450c5
Contents?: true
Size: 1.28 KB
Versions: 53
Compression:
Stored size: 1.28 KB
Contents
class InlineRadioOptions extends React.Component { constructor(props) { super(props); this.state = { value: props.value } } onChange(value) { this.setState({ value: value }) } render() { const { name, label, options } = this.props; const optionElements = options.map((option, optionIndex) => { return ( <InputRadio key={option.value} name={name} value={option.value} label={option.label} inline={true} isLast={optionIndex === (options.length - 1)} checked={option.value === this.state.value} onChange={this.onChange.bind(this)} /> ); }); return ( <CardSection wrappable={true}> <div className="wrappable__item wrappable__item--no-flex"> <span>{label}</span> </div> <div className="wrappable__item"> {optionElements} </div> </CardSection> ); } } InlineRadioOptions.propTypes = { name: React.PropTypes.string, options: React.PropTypes.arrayOf( React.PropTypes.shape({ label: React.PropTypes.string.isRequired, value: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.bool ]).isRequired }) ).isRequired };
Version data entries
53 entries across 53 versions & 1 rubygems