Visitar URL original
feat(app): polish select-v2 component (#30446) · anomalyco/opencode@134a5c8 · GitHub
Skip to content

Commit 134a5c8

Browse files
arvsrnBrendonovich
andauthored
feat(app): polish select-v2 component (#30446)
Co-authored-by: Brendan Allan <git@brendonovich.dev>
1 parent 2538c0d commit 134a5c8

8 files changed

Lines changed: 148 additions & 306 deletions

File tree

‎packages/app/src/components/settings-v2/general.tsx‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, Show, createMemo, createResource, onMount } from "solid-js"
22
import { createStore } from "solid-js/store"
33
import { ButtonV2 } from "@opencode-ai/ui/v2/button-v2"
44
import { Icon } from "@opencode-ai/ui/icon"
5-
import { SelectV2 } from "@opencode-ai/ui/select-v2"
5+
import { SelectV2 } from "@opencode-ai/ui/v2/select-v2"
66
import { Switch } from "@opencode-ai/ui/v2/switch-v2"
77
import { TextInputV2 } from "@opencode-ai/ui/v2/text-input-v2"
88
import { Tooltip } from "@opencode-ai/ui/tooltip"
@@ -289,7 +289,7 @@ export const SettingsGeneralV2: Component = () => {
289289
if (!option) return
290290
playDemoSound(option.id === "none" ? undefined : option.id)
291291
},
292-
onSelect: (option: (typeof soundOptions)[number] | undefined) => {
292+
onSelect: (option: (typeof soundOptions)[number] | null) => {
293293
if (!option) return
294294
if (option.id === "none") {
295295
setEnabled(false)
@@ -310,8 +310,11 @@ export const SettingsGeneralV2: Component = () => {
310310
description={language.t("settings.general.row.language.description")}
311311
>
312312
<SelectV2
313+
appearance="inline"
313314
data-action="settings-language"
314315
options={languageOptions()}
316+
placement="bottom-end"
317+
gutter={6}
315318
current={languageOptions().find((o) => o.value === language.locale())}
316319
value={(o) => o.value}
317320
label={(o) => o.label}
@@ -333,9 +336,12 @@ export const SettingsGeneralV2: Component = () => {
333336
description={language.t("settings.general.row.shell.description")}
334337
>
335338
<SelectV2
339+
appearance="inline"
336340
data-action="settings-shell"
337341
options={shellOptions()}
338342
current={shellOptions().find((o) => o.value === currentShell()) ?? autoOption}
343+
placement="bottom-end"
344+
gutter={6}
339345
value={(o) => o.id}
340346
label={(o) => o.label}
341347
onSelect={(option) => {
@@ -505,9 +511,12 @@ export const SettingsGeneralV2: Component = () => {
505511
description={language.t("settings.general.row.colorScheme.description")}
506512
>
507513
<SelectV2
514+
appearance="inline"
508515
data-action="settings-color-scheme"
509516
options={colorSchemeOptions()}
510517
current={colorSchemeOptions().find((o) => o.value === theme.colorScheme())}
518+
placement="bottom-end"
519+
gutter={6}
511520
value={(o) => o.value}
512521
label={(o) => o.label}
513522
onSelect={(option) => option && theme.setColorScheme(option.value)}
@@ -531,9 +540,12 @@ export const SettingsGeneralV2: Component = () => {
531540
}
532541
>
533542
<SelectV2
543+
appearance="inline"
534544
data-action="settings-theme"
535545
options={themeOptions()}
536546
current={themeOptions().find((o) => o.id === theme.themeId())}
547+
placement="bottom-end"
548+
gutter={6}
537549
value={(o) => o.id}
538550
label={(o) => o.name}
539551
onSelect={(option) => {
@@ -671,13 +683,16 @@ export const SettingsGeneralV2: Component = () => {
671683
description={language.t("settings.general.sounds.agent.description")}
672684
>
673685
<SelectV2
686+
appearance="inline"
674687
data-action="settings-sounds-agent"
675688
{...soundSelectProps(
676689
() => settings.sounds.agentEnabled(),
677690
() => settings.sounds.agent(),
678691
(value) => settings.sounds.setAgentEnabled(value),
679692
(id) => settings.sounds.setAgent(id),
680693
)}
694+
placement="bottom-end"
695+
gutter={6}
681696
/>
682697
</SettingsRowV2>
683698

@@ -686,13 +701,16 @@ export const SettingsGeneralV2: Component = () => {
686701
description={language.t("settings.general.sounds.permissions.description")}
687702
>
688703
<SelectV2
704+
appearance="inline"
689705
data-action="settings-sounds-permissions"
690706
{...soundSelectProps(
691707
() => settings.sounds.permissionsEnabled(),
692708
() => settings.sounds.permissions(),
693709
(value) => settings.sounds.setPermissionsEnabled(value),
694710
(id) => settings.sounds.setPermissions(id),
695711
)}
712+
placement="bottom-end"
713+
gutter={6}
696714
/>
697715
</SettingsRowV2>
698716

@@ -701,13 +719,16 @@ export const SettingsGeneralV2: Component = () => {
701719
description={language.t("settings.general.sounds.errors.description")}
702720
>
703721
<SelectV2
722+
appearance="inline"
704723
data-action="settings-sounds-errors"
705724
{...soundSelectProps(
706725
() => settings.sounds.errorsEnabled(),
707726
() => settings.sounds.errors(),
708727
(value) => settings.sounds.setErrorsEnabled(value),
709728
(id) => settings.sounds.setErrors(id),
710729
)}
730+
placement="bottom-end"
731+
gutter={6}
711732
/>
712733
</SettingsRowV2>
713734
</SettingsListV2>

‎packages/app/src/components/settings-v2/settings-v2.css‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,12 @@
153153
width: 100%;
154154
}
155155

156-
[data-component="settings-v2-dialog"] [data-component="select"][data-trigger-style="settings-v2"] {
156+
[data-component="settings-v2-dialog"] [data-component="select-v2-root"] {
157157
width: fit-content;
158158
max-width: 100%;
159159
}
160160

161-
[data-component="settings-v2-dialog"]
162-
[data-component="select"][data-trigger-style="settings-v2"]
163-
[data-component="button-v2"] {
161+
[data-component="settings-v2-dialog"] [data-component="button-v2"] {
164162
width: fit-content;
165163
max-width: 100%;
166164
}

‎packages/ui/src/components/select-v2.css‎

Lines changed: 0 additions & 87 deletions
This file was deleted.

‎packages/ui/src/components/select-v2.stories.tsx‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)