summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-28 15:47:05 -0600
committerAdam <[email protected]>2025-12-28 15:47:05 -0600
commita4411c21b6687e7392447da08dbaec2dc530075f (patch)
tree6bbcdc798fb325da57a91ebec460e348a0d96d63 /packages/ui/src/components
parent9d61370ac458627c394195ef761669ba70c93237 (diff)
downloadopencode-a4411c21b6687e7392447da08dbaec2dc530075f.tar.gz
opencode-a4411c21b6687e7392447da08dbaec2dc530075f.zip
feat(desktop): theme preview
Diffstat (limited to 'packages/ui/src/components')
-rw-r--r--packages/ui/src/components/list.tsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/ui/src/components/list.tsx b/packages/ui/src/components/list.tsx
index 4f6df0faf..808c9b032 100644
--- a/packages/ui/src/components/list.tsx
+++ b/packages/ui/src/components/list.tsx
@@ -15,6 +15,7 @@ export interface ListProps<T> extends FilteredListProps<T> {
children: (item: T) => JSX.Element
emptyMessage?: string
onKeyEvent?: (event: KeyboardEvent, item: T | undefined) => void
+ onMove?: (item: T | undefined) => void
activeIcon?: IconProps["name"]
filter?: string
search?: ListSearchProps | boolean
@@ -82,6 +83,13 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
element?.scrollIntoView({ block: "center", behavior: "smooth" })
})
+ createEffect(() => {
+ const all = flat()
+ const current = active()
+ const item = all.find((x) => props.key(x) === current)
+ props.onMove?.(item)
+ })
+
const handleSelect = (item: T | undefined, index: number) => {
props.onSelect?.(item, index)
}