import React from 'react'; import PropTypes from 'prop-types'; class HorizontalSelector extends React.Component { constructor(props) { super(props); this.state = { option: this.props.options[0].value, }; this.selectOption = this.selectOption.bind(this); } selectOption(opt) { this.props.onChange(opt); this.setState({ option: opt }); } getOptionElems() { return this.props.options.map(opt => { let active = opt.value === this.state.option ? 'btn-primary active' : ''; return ( ); }); } render() { const optionElems = this.getOptionElems(); return