-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathRepositoriesResultFormat.tsx
More file actions
44 lines (38 loc) · 1.14 KB
/
RepositoriesResultFormat.tsx
File metadata and controls
44 lines (38 loc) · 1.14 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
import * as React from "react";
import { useCallback } from "react";
import { styled } from "styled-components";
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react";
import { Codicon } from "../common";
import { ResultFormat } from "../../variant-analysis/shared/variant-analysis-result-format";
const Dropdown = styled(VSCodeDropdown)`
width: 100%;
`;
type Props = {
value: ResultFormat;
onChange: (value: ResultFormat) => void;
className?: string;
};
export const RepositoriesResultFormat = ({
value,
onChange,
className,
}: Props) => {
const handleInput = useCallback(
(e: InputEvent) => {
const target = e.target as HTMLSelectElement;
onChange(target.value as ResultFormat);
},
[onChange],
);
return (
<Dropdown value={value} onInput={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>
);
};