mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
20 lines
676 B
TypeScript
20 lines
676 B
TypeScript
import React, { useCallback } from 'react';
|
|
|
|
import { FieldOverrideEditorProps, SelectableValue } from '@grafana/data';
|
|
import { GraphTresholdsStyleMode } from '@grafana/schema';
|
|
import { Select } from '@grafana/ui';
|
|
|
|
type Props = FieldOverrideEditorProps<SelectableValue<{ mode: GraphTresholdsStyleMode }>, unknown>;
|
|
|
|
export const ThresholdsStyleEditor = ({ item, value, onChange, id }: Props) => {
|
|
const onChangeCb = useCallback(
|
|
(v: SelectableValue<GraphTresholdsStyleMode>) => {
|
|
onChange({
|
|
mode: v.value,
|
|
});
|
|
},
|
|
[onChange]
|
|
);
|
|
return <Select inputId={id} value={value.mode} options={item.settings.options} onChange={onChangeCb} />;
|
|
};
|