File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
extensions/ql-vscode/src/view/common Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import * as React from "react";
22import { ChangeEvent } from "react" ;
33import { styled } from "styled-components" ;
44
5+ const DISABLED_VALUE = "-" ;
6+
57const StyledDropdown = styled . select `
68 width: 100%;
79 height: calc(var(--input-height) * 1px);
@@ -31,18 +33,20 @@ type Props = {
3133export function Dropdown ( { value, options, disabled, onChange } : Props ) {
3234 return (
3335 < StyledDropdown
34- value = { disabled ? undefined : value }
36+ value = { disabled ? DISABLED_VALUE : value }
3537 disabled = { disabled }
3638 onChange = { onChange }
3739 >
38- { ! disabled && (
39- < >
40- { options . map ( ( option ) => (
41- < option key = { option . value } value = { option . value } >
42- { option . label }
43- </ option >
44- ) ) }
45- </ >
40+ { disabled ? (
41+ < option key = { DISABLED_VALUE } value = { DISABLED_VALUE } >
42+ { DISABLED_VALUE }
43+ </ option >
44+ ) : (
45+ options . map ( ( option ) => (
46+ < option key = { option . value } value = { option . value } >
47+ { option . label }
48+ </ option >
49+ ) )
4650 ) }
4751 </ StyledDropdown >
4852 ) ;
You can’t perform that action at this time.
0 commit comments