Skip to content

Commit db0339b

Browse files
committed
fix: Use Dropdown instead of select in settings for more ui consistency
1 parent f70e3fc commit db0339b

File tree

2 files changed

+30
-36
lines changed

2 files changed

+30
-36
lines changed

webview-ui/src/components/settings/ApiConfigManager.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { VSCodeButton, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
22
import { memo, useEffect, useRef, useState } from "react"
33
import { ApiConfigMeta } from "../../../../src/shared/ExtensionMessage"
4+
import { Dropdown } from "vscrui"
5+
import type { DropdownOption } from "vscrui"
46

57
interface ApiConfigManagerProps {
68
currentApiConfigName?: string
@@ -133,28 +135,20 @@ const ApiConfigManager = ({
133135
) : (
134136
<>
135137
<div style={{ display: "flex", gap: "4px", alignItems: "center" }}>
136-
<select
138+
<Dropdown
137139
id="config-profile"
138140
value={currentApiConfigName}
139-
onChange={(e) => onSelectConfig(e.target.value)}
141+
onChange={(value: unknown) => {
142+
onSelectConfig((value as DropdownOption).value)
143+
}}
140144
style={{
141-
flexGrow: 1,
142-
padding: "4px 8px",
143-
paddingRight: "24px",
144-
backgroundColor: "var(--vscode-dropdown-background)",
145-
color: "var(--vscode-dropdown-foreground)",
146-
border: "1px solid var(--vscode-dropdown-border)",
147-
borderRadius: "2px",
148-
height: "28px",
149-
cursor: "pointer",
150-
outline: "none",
151-
}}>
152-
{listApiConfigMeta?.map((config) => (
153-
<option key={config.name} value={config.name}>
154-
{config.name}
155-
</option>
156-
))}
157-
</select>
145+
minWidth: 130,
146+
}}
147+
options={listApiConfigMeta.map((config) => ({
148+
value: config.name,
149+
label: config.name,
150+
}))}
151+
/>
158152
<VSCodeButton
159153
appearance="icon"
160154
onClick={handleAdd}

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { validateApiConfiguration, validateModelId } from "../../utils/validate"
55
import { vscode } from "../../utils/vscode"
66
import ApiOptions from "./ApiOptions"
77
import ApiConfigManager from "./ApiConfigManager"
8+
import { Dropdown } from "vscrui"
9+
import type { DropdownOption } from "vscrui"
810

911
type SettingsViewProps = {
1012
onDone: () => void
@@ -444,23 +446,21 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
444446
<h3 style={{ color: "var(--vscode-foreground)", margin: "0 0 15px 0" }}>Browser Settings</h3>
445447
<div style={{ marginBottom: 15 }}>
446448
<label style={{ fontWeight: "500", display: "block", marginBottom: 5 }}>Viewport size</label>
447-
<select
448-
value={browserViewportSize}
449-
onChange={(e) => setBrowserViewportSize(e.target.value)}
450-
style={{
451-
width: "100%",
452-
padding: "4px 8px",
453-
backgroundColor: "var(--vscode-input-background)",
454-
color: "var(--vscode-input-foreground)",
455-
border: "1px solid var(--vscode-input-border)",
456-
borderRadius: "2px",
457-
height: "28px",
458-
}}>
459-
<option value="1280x800">Large Desktop (1280x800)</option>
460-
<option value="900x600">Small Desktop (900x600)</option>
461-
<option value="768x1024">Tablet (768x1024)</option>
462-
<option value="360x640">Mobile (360x640)</option>
463-
</select>
449+
<div className="dropdown-container">
450+
<Dropdown
451+
value={browserViewportSize}
452+
onChange={(value: unknown) => {
453+
setBrowserViewportSize((value as DropdownOption).value)
454+
}}
455+
style={{ width: "100%" }}
456+
options={[
457+
{ value: "1280x800", label: "Large Desktop (1280x800)" },
458+
{ value: "900x600", label: "Small Desktop (900x600)" },
459+
{ value: "768x1024", label: "Tablet (768x1024)" },
460+
{ value: "360x640", label: "Mobile (360x640)" },
461+
]}
462+
/>
463+
</div>
464464
<p
465465
style={{
466466
fontSize: "12px",

0 commit comments

Comments
 (0)