1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
868 B

import React from 'react';
import { cx } from '@emotion/css';
import { SelectableValue } from '@grafana/data';
import { unwrap } from './unwrap';
import { Select } from '@grafana/ui';
import { paddingRightClass } from './styles';
type Mode = 'ASC' | 'DESC';
const OPTIONS: Array<SelectableValue<Mode>> = [
{ label: 'ascending', value: 'ASC' },
{ label: 'descending', value: 'DESC' },
];
const className = cx('width-9', paddingRightClass);
type Props = {
value: Mode;
onChange: (value: Mode) => void;
inputId?: string;
};
export const OrderByTimeSection = ({ value, onChange, inputId }: Props): JSX.Element => {
return (
<>
<Select<Mode>
inputId={inputId}
className={className}
onChange={(v) => {
onChange(unwrap(v.value));
}}
value={value}
options={OPTIONS}
/>
</>
);
};