MyCrypto/common/components/ui/SimpleSelect.tsx

28 lines
621 B
TypeScript

import React, { Component } from 'react';
interface Props {
value?: string;
options: string[];
onChange(event: React.SyntheticEvent<HTMLSpanElement>): void;
}
export default class SimpleSelect extends Component<Props, {}> {
public render() {
return (
<select
value={this.props.value || this.props.options[0]}
className={'form-control'}
onChange={this.props.onChange}
>
{this.props.options.map((obj, i) => {
return (
<option value={obj} key={i}>
{obj}
</option>
);
})}
</select>
);
}
}