Skip to content

Commit 015e684

Browse files
fix(TypeAheadVariableDropdown): dynamic width for input bar (#5348)
1 parent 71c5a5e commit 015e684

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/variables/components/TypeAheadVariableDropdown.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ class TypeAheadVariableDropdown extends PureComponent<Props> {
3838
name: selectedValue,
3939
} as SelectableItem
4040

41-
const typeAheadStyle = {width: '150px'}
41+
// handle the case where the selected value is ""
42+
const calculatedWidth =
43+
selectedVariableValue.name?.length > 0
44+
? selectedVariableValue.name.length * 8 + 110
45+
: 150
46+
const typeAheadStyle = {
47+
width: `${calculatedWidth}px`,
48+
}
4249
return (
4350
<TypeAheadDropDown
4451
style={typeAheadStyle}

0 commit comments

Comments
 (0)