40 lines
727 B
React
Raw Normal View History

2017-06-27 02:27:55 +04:00
// @flow
import React from 'react';
2017-09-07 15:14:52 -05:00
import SimpleDropDown from 'components/ui/SimpleDropDown';
2017-06-27 02:27:55 +04:00
2017-09-07 15:14:52 -05:00
type UnitDropdownProps = {
value: string,
options: string[],
onChange?: (value: string) => void
};
2017-07-16 03:05:57 +04:00
2017-06-27 02:27:55 +04:00
export default class UnitDropdown extends React.Component {
2017-09-07 15:14:52 -05:00
props: UnitDropdownProps;
2017-07-02 00:49:06 -05:00
state: {
expanded: boolean
} = {
expanded: false
};
2017-06-27 02:27:55 +04:00
2017-07-02 00:49:06 -05:00
render() {
2017-09-07 15:14:52 -05:00
const { value, options } = this.props;
2017-06-27 02:27:55 +04:00
2017-07-02 00:49:06 -05:00
return (
<div className="input-group-btn">
2017-09-07 15:14:52 -05:00
<SimpleDropDown
value={value}
onChange={this.onChange}
options={options}
/>
2017-07-02 00:49:06 -05:00
</div>
);
}
2017-06-27 02:27:55 +04:00
2017-07-16 03:05:57 +04:00
onChange = (value: string) => {
if (this.props.onChange) {
this.props.onChange(value);
}
2017-07-16 03:05:57 +04:00
};
2017-06-27 02:27:55 +04:00
}