-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathdebugger-picker.component.tsx
More file actions
78 lines (70 loc) · 1.81 KB
/
debugger-picker.component.tsx
File metadata and controls
78 lines (70 loc) · 1.81 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"use client";
import React from "react";
import styles from "./debugger-picker.module.scss";
import dynamic from "next/dynamic";
interface PickerLabelProps {
label: string | null;
}
const Select = dynamic(() => import("react-select"), { ssr: false });
const PickerLabel: React.FC<PickerLabelProps> = ({ label }) => {
return (
<div className={styles.picker__label}>
<span className={styles.picker__fullName}>{label}</span>
</div>
);
};
interface DebuggerPickerComponentProps {
label: string | null;
options;
isGrouped?: boolean;
placeholder: string | null;
minWidth: string | null;
}
export const DebuggerPickerComponent: React.FC<
DebuggerPickerComponentProps
> = ({
label,
options,
placeholder,
minWidth,
}) => {
return (
<div className={styles.picker} data-has-label={label !== null}>
{label && <PickerLabel label={label} />}
<Select
aria-label={"Debugger picker"}
className="react-select-container"
options={options}
defaultValue={options[0]}
classNamePrefix={"react-select"}
isSearchable={false}
placeholder={placeholder}
styles={{
control: (base) => ({
...base,
minHeight: "1.75rem",
height: "1.75rem",
padding: "4px",
...(minWidth ? { minWidth: minWidth } : {}),
}),
valueContainer: (base) => ({
...base,
height: "1.75rem",
padding: "0 8px",
}),
input: (base) => ({
...base,
margin: "0px",
}),
indicatorSeparator: () => ({
display: "none",
}),
indicatorsContainer: (base) => ({
...base,
height: "1.75rem",
}),
}}
></Select>
</div>
);
};