File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed
extensions/ql-vscode/src/view/common Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,17 @@ import * as React from "react";
22import { ChangeEvent } from "react" ;
33import { styled } from "styled-components" ;
44
5- const StyledDropdown = styled . select `
5+ const DISABLED_VALUE = "-" ;
6+
7+ const StyledDropdown = styled . select < { disabled ?: boolean } > `
68 width: 100%;
79 height: calc(var(--input-height) * 1px);
810 background: var(--vscode-dropdown-background);
911 color: var(--vscode-foreground);
10- border: none ;
12+ border-width: 0 5px 0 0 ;
1113 padding: 2px 6px 2px 8px;
14+ opacity: ${ ( props ) =>
15+ props . disabled ? "var(--disabled-opacity)" : "inherit" } ;
1216` ;
1317
1418type Props = {
@@ -31,18 +35,20 @@ type Props = {
3135export function Dropdown ( { value, options, disabled, onChange } : Props ) {
3236 return (
3337 < StyledDropdown
34- value = { disabled ? undefined : value }
38+ value = { disabled ? DISABLED_VALUE : value }
3539 disabled = { disabled }
3640 onChange = { onChange }
3741 >
38- { ! disabled && (
39- < >
40- { options . map ( ( option ) => (
41- < option key = { option . value } value = { option . value } >
42- { option . label }
43- </ option >
44- ) ) }
45- </ >
42+ { disabled ? (
43+ < option key = { DISABLED_VALUE } value = { DISABLED_VALUE } >
44+ { DISABLED_VALUE }
45+ </ option >
46+ ) : (
47+ options . map ( ( option ) => (
48+ < option key = { option . value } value = { option . value } >
49+ { option . label }
50+ </ option >
51+ ) )
4652 ) }
4753 </ StyledDropdown >
4854 ) ;
You can’t perform that action at this time.
0 commit comments