Skip to content

Commit df8dc6c

Browse files
leafygreen
1 parent 0489bcc commit df8dc6c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/compass-settings/src/components/settings/settings-list.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
css,
1414
spacing,
1515
TextInput,
16+
Select,
17+
Option,
1618
FormFieldContainer,
1719
Badge,
1820
} from '@mongodb-js/compass-components';
@@ -170,35 +172,33 @@ function DefaultSortOrderSetting<PreferenceName extends 'defaultSortOrder'>({
170172
disabled: boolean;
171173
}) {
172174
const optionDescriptions = getSettingDescription(name).description.options;
173-
const onChangeEvent = useCallback(
174-
(event: React.ChangeEvent<HTMLSelectElement>) => {
175-
onChange(
176-
name,
177-
event.target.value as UserConfigurablePreferences[PreferenceName]
178-
);
175+
const onChangeCallback = useCallback(
176+
(value: string) => {
177+
onChange(name, value as UserConfigurablePreferences[PreferenceName]);
179178
},
180179
[name, onChange]
181180
);
182181

183182
return (
184183
<>
185184
<SettingLabel name={name} />
186-
<select
185+
<Select
187186
className={inputStyles}
187+
allowDeselect={false}
188188
aria-labelledby={`${name}-label`}
189189
id={name}
190190
name={name}
191191
data-testid={name}
192-
value={value === undefined ? '' : `${value}`}
193-
onChange={onChangeEvent}
192+
value={value}
193+
onChange={onChangeCallback}
194194
disabled={disabled}
195195
>
196-
{SORT_ORDER_VALUES.map((option, i) => (
197-
<option key={i} value={option}>
196+
{SORT_ORDER_VALUES.map((option) => (
197+
<Option key={option} value={option}>
198198
{(optionDescriptions && optionDescriptions[option]) || value}
199-
</option>
199+
</Option>
200200
))}
201-
</select>
201+
</Select>
202202
</>
203203
);
204204
}

0 commit comments

Comments
 (0)