diff options
| author | Daniel Polito <[email protected]> | 2026-01-13 12:41:35 -0300 |
|---|---|---|
| committer | Frank <[email protected]> | 2026-01-13 19:50:49 -0500 |
| commit | 3c9d80d75f8cd506c776b3d2f753d28d6f81d1cd (patch) | |
| tree | c12d4de08278fb44e31521dcc8c6ab311eee5938 /packages/ui/src/components/list.tsx | |
| parent | a761f66a16dc0a2b116477c328d8a49f5c0a947a (diff) | |
| download | opencode-3c9d80d75f8cd506c776b3d2f753d28d6f81d1cd.tar.gz opencode-3c9d80d75f8cd506c776b3d2f753d28d6f81d1cd.zip | |
feat(desktop): Adding Provider Icons (#8215)
Diffstat (limited to 'packages/ui/src/components/list.tsx')
| -rw-r--r-- | packages/ui/src/components/list.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/ui/src/components/list.tsx b/packages/ui/src/components/list.tsx index 1283b3023..8c92728d7 100644 --- a/packages/ui/src/components/list.tsx +++ b/packages/ui/src/components/list.tsx @@ -10,9 +10,15 @@ export interface ListSearchProps { autofocus?: boolean } +export interface ListGroup<T> { + category: string + items: T[] +} + export interface ListProps<T> extends FilteredListProps<T> { class?: string children: (item: T) => JSX.Element + groupHeader?: (group: ListGroup<T>) => JSX.Element emptyMessage?: string onKeyEvent?: (event: KeyboardEvent, item: T | undefined) => void onMove?: (item: T | undefined) => void @@ -116,7 +122,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void }) setScrollRef, }) - function GroupHeader(props: { category: string }): JSX.Element { + function GroupHeader(groupProps: { category: string; children?: JSX.Element }): JSX.Element { const [stuck, setStuck] = createSignal(false) const [header, setHeader] = createSignal<HTMLDivElement | undefined>(undefined) @@ -138,7 +144,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void }) return ( <div data-slot="list-header" data-stuck={stuck()} ref={setHeader}> - {props.category} + {groupProps.children ?? groupProps.category} </div> ) } @@ -185,7 +191,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void }) {(group) => ( <div data-slot="list-group"> <Show when={group.category}> - <GroupHeader category={group.category} /> + <GroupHeader category={group.category}>{props.groupHeader?.(group)}</GroupHeader> </Show> <div data-slot="list-items"> <For each={group.items}> |
