import type { MouseEvent } from 'react' type LibraryListButton = { title: string onClick: (ev: MouseEvent) => void } type LibraryListItem = { key: string className: string icon: string name: string detail?: string nameClassName?: string onClick: () => void button?: LibraryListButton } type LibraryListProps = { loading: boolean error: string | null items: LibraryListItem[] } export function LibraryList({ loading, error, items }: LibraryListProps) { if (loading) { return (
) } if (error) { return
{error}
} return ( <> {items.map((item) => (
{item.icon} {item.name} {item.detail ? {item.detail} : null} {item.button ? ( ) : null}
))} ) }