- Notifications
You must be signed in to change notification settings - Fork 440
/
Copy patharduino-select.tsx
62 lines (60 loc) · 1.76 KB
/
arduino-select.tsx
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
importReactfrom'@theia/core/shared/react';
importtype{Props,StylesConfig,ThemeConfig}from'react-select';
importSelectfrom'react-select';
exportclassArduinoSelectextendsReact.Component<Props>{
constructor(props: Props){
super(props);
}
overriderender(): React.ReactNode{
constcontrolHeight=27;// from `monitor.css` -> `.serial-monitor-container .head` (`height: 27px;`)
conststyles: StylesConfig={
control: (styles)=>({
...styles,
minWidth: 120,
color: 'var(--theia-foreground)',
}),
dropdownIndicator: (styles)=>({
...styles,
padding: 0,
}),
indicatorSeparator: ()=>({
display: 'none',
}),
indicatorsContainer: ()=>({
padding: '0px 5px',
}),
menu: (styles)=>({
...styles,
marginTop: 0,
}),
};
consttheme: ThemeConfig=(theme)=>({
...theme,
borderRadius: 0,
spacing: {
controlHeight,
baseUnit: 2,
menuGutter: 4,
},
colors: {
...theme.colors,
// `primary50`??? it's crazy but apparently, without this, we would get a light-blueish
// color when selecting an option in the select by clicking and then not releasing the button.
// https://react-select.com/styles#overriding-the-theme
primary50: 'var(--theia-list-activeSelectionBackground)',
},
});
constDropdownIndicator=()=><spanclassName="fa fa-caret-down caret"/>;
return(
<Select
{...this.props}
className="theia-select"
components={{ DropdownIndicator }}
theme={theme}
styles={styles}
classNamePrefix="arduino-select"
isSearchable={false}
/>
);
}
}