Files
grafana/public/app/plugins/datasource/cloud-monitoring/components/SimpleSelect.tsx
Torkel Ödegaard 1d689888b0 Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files

* Update eslint plugin

* updated files
2021-01-20 07:59:48 +01:00

27 lines
807 B
TypeScript

import React, { ChangeEvent, FC } from 'react';
interface Props {
onValueChange: (e: ChangeEvent<HTMLSelectElement>) => void;
options: Array<{ value: string; name: string }>;
value: string;
label: string;
}
export const SimpleSelect: FC<Props> = (props) => {
const { label, onValueChange, value, options } = props;
return (
<div className="gf-form max-width-21">
<span className="gf-form-label width-10 query-keyword">{label}</span>
<div className="gf-form-select-wrapper max-width-12">
<select className="gf-form-input" required onChange={onValueChange} value={value}>
{options.map(({ value, name }, i) => (
<option key={i} value={value}>
{name}
</option>
))}
</select>
</div>
</div>
);
};