MyCrypto/common/components/ui/SimpleSelect.jsx

31 lines
612 B
React
Raw Normal View History

// @flow
import React, { Component } from 'react';
2017-09-07 20:14:52 +00:00
type Props = {
value?: string,
options: string[],
onChange: (event: SyntheticInputEvent) => void
};
2017-09-07 20:14:52 +00:00
export default class SimpleSelect extends Component {
props: Props;
render() {
return (
<select
value={this.props.value || this.props.options[0]}
2017-09-07 20:14:52 +00:00
className={'form-control'}
onChange={this.props.onChange}
>
{this.props.options.map((obj, i) => {
return (
<option value={obj} key={i}>
{obj}
</option>
);
})}
</select>
);
}
}