1import React from 'react';
2import PropTypes from 'prop-types';
4class HorizontalSelector extends React.Component {
9 option: this.props.options[0].value,
12 this.selectOption = this.selectOption.bind(this);
16 this.props.onChange(opt);
17 this.setState({ option: opt });
21 return this.props.options.map(opt => {
22 let active = opt.value === this.state.option ? 'btn-primary active' : '';
25 key={opt.value.toString()}
26 className={`btn ${active} h-10 ph-4 flex sans ${this.props.className}`}
27 onClick={() => this.selectOption(opt.value)}>
35 const optionElems = this.getOptionElems();
37 return <div className="btn-group">{optionElems}</div>;
41HorizontalSelector.propTypes = {
42 className: PropTypes.string,
43 options: PropTypes.array,
46HorizontalSelector.defaultProps = {
51export default HorizontalSelector;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list