-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathRepositoriesResultFormat.tsx
More file actions
46 lines (40 loc) · 1.11 KB
/
RepositoriesResultFormat.tsx
File metadata and controls
46 lines (40 loc) · 1.11 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
41
42
43
44
45
46
import { useCallback } from "react";
import { styled } from "styled-components";
import {
VscodeOption,
VscodeSingleSelect,
} from "@vscode-elements/react-elements";
import { Codicon } from "../common";
import { ResultFormat } from "../../variant-analysis/shared/variant-analysis-result-format";
const Dropdown = styled(VscodeSingleSelect)`
width: 100%;
`;
type Props = {
value: ResultFormat;
onChange: (value: ResultFormat) => void;
className?: string;
};
export const RepositoriesResultFormat = ({
value,
onChange,
className,
}: Props) => {
const handleInput = useCallback(
(e: Event) => {
const target = e.target as HTMLSelectElement;
onChange(target.value as ResultFormat);
},
[onChange],
);
return (
<Dropdown value={value} onChange={handleInput} className={className}>
<Codicon name="table" label="Result format..." slot="indicator" />
<VscodeOption value={ResultFormat.Alerts}>
{ResultFormat.Alerts}
</VscodeOption>
<VscodeOption value={ResultFormat.RawResults}>
{ResultFormat.RawResults}
</VscodeOption>
</Dropdown>
);
};