forked from SigNoz/signoz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
44 lines (36 loc) · 1.13 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { RadioChangeEvent } from 'antd';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { FieldTitle } from '../styles';
import { OptionsMenuConfig } from '../types';
import { FormatFieldWrapper, RadioButton, RadioGroup } from './styles';
function FormatField({ config }: FormatFieldProps): JSX.Element | null {
const { t } = useTranslation(['trace']);
const onChange = useCallback(
(event: RadioChangeEvent) => {
if (!config) return;
config.onChange(event.target.value);
},
[config],
);
if (!config) return null;
return (
<FormatFieldWrapper direction="vertical">
<FieldTitle>{t('options_menu.format')}</FieldTitle>
<RadioGroup
size="small"
buttonStyle="solid"
value={config.value}
onChange={onChange}
>
<RadioButton value="raw">{t('options_menu.raw')}</RadioButton>
<RadioButton value="list">{t('options_menu.default')}</RadioButton>
<RadioButton value="table">{t('options_menu.column')}</RadioButton>
</RadioGroup>
</FormatFieldWrapper>
);
}
interface FormatFieldProps {
config: OptionsMenuConfig['format'];
}
export default FormatField;