2018-10-26 15:57:01 +02:00
|
|
|
import React, { SFC } from 'react';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
2018-11-09 14:30:28 +01:00
|
|
|
onValueChange: (e) => void;
|
|
|
|
|
options: any[];
|
2018-10-29 14:56:55 +01:00
|
|
|
value: string;
|
|
|
|
|
label: string;
|
2018-10-26 15:57:01 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-31 13:55:40 +01:00
|
|
|
const SimpleSelect: SFC<Props> = props => {
|
2018-10-31 11:16:49 +01:00
|
|
|
const { label, onValueChange, value, options } = props;
|
2018-10-26 15:57:01 +02:00
|
|
|
return (
|
|
|
|
|
<div className="gf-form max-width-21">
|
2018-11-19 16:26:06 +01:00
|
|
|
<span className="gf-form-label width-10 query-keyword">{label}</span>
|
2018-11-19 16:06:30 +01:00
|
|
|
<div className="gf-form-select-wrapper max-width-12">
|
2018-10-31 11:16:49 +01:00
|
|
|
<select className="gf-form-input" required onChange={onValueChange} value={value}>
|
|
|
|
|
{options.map(({ value, name }, i) => (
|
|
|
|
|
<option key={i} value={value}>
|
|
|
|
|
{name}
|
2018-10-31 10:48:24 +01:00
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-31 13:55:40 +01:00
|
|
|
export default SimpleSelect;
|