-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathModelAlertsSort.tsx
More file actions
40 lines (34 loc) · 1.04 KB
/
ModelAlertsSort.tsx
File metadata and controls
40 lines (34 loc) · 1.04 KB
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
import { useCallback } from "react";
import { styled } from "styled-components";
import {
VscodeOption,
VscodeSingleSelect,
} from "@vscode-elements/react-elements";
import { SortKey } from "../../model-editor/shared/model-alerts-filter-sort";
import { Codicon } from "../common";
const Dropdown = styled(VscodeSingleSelect)`
width: 100%;
`;
type Props = {
value: SortKey;
onChange: (value: SortKey) => void;
className?: string;
};
export const ModelAlertsSort = ({ value, onChange, className }: Props) => {
const handleInput = useCallback(
(e: Event) => {
const target = e.target as HTMLSelectElement;
onChange(target.value as SortKey);
},
[onChange],
);
return (
<Dropdown value={value} onChange={handleInput} className={className}>
<Codicon name="sort-precedence" label="Sort..." slot="indicator" />
<VscodeOption value={SortKey.Alphabetically}>Alphabetically</VscodeOption>
<VscodeOption value={SortKey.NumberOfResults}>
Number of results
</VscodeOption>
</Dropdown>
);
};