Theme selector UX (current theme indicator and easier selection) (#4623)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Youssef Achy
2025-11-25 13:53:01 -06:00
committed by GitHub
parent cd67804412
commit 3366a71155
2 changed files with 18 additions and 5 deletions

View File

@@ -50,6 +50,15 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
filter: "",
})
createEffect(() => {
if (props.current) {
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, props.current))
if (currentIndex >= 0) {
setStore("selected", currentIndex)
}
}
})
let input: InputRenderable
const filtered = createMemo(() => {
@@ -88,7 +97,14 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
createEffect(() => {
store.filter
setStore("selected", 0)
if (store.filter.length > 0) {
setStore("selected", 0)
} else if (props.current) {
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, props.current))
if (currentIndex >= 0) {
setStore("selected", currentIndex)
}
}
scroll.scrollTo(0)
})