import type { ReactNode } from 'react'; import { ChevronRight } from 'lucide-react'; // Shared visual language for the /soulseek grouped views (search results + downloads). Each top-level // grouping (a peer/user) is an almost-black Card; each folder within it is a lifted SubCard. Kept here // so search and downloads stay pixel-identical — change the look in one place. export const Card = ({ children }: { children: ReactNode }) => (
{children}
); // Supply exactly one of `title` (inert text — the whole row becomes the collapse toggle) or `titleMenu` // (an interactive node such as the peer dropdown). A trigger can't live inside the toggle button, so with // `titleMenu` the row splits: the chevron and the empty space after the node toggle, the node itself doesn't. type CardHeaderProps = { open: boolean; onToggle: () => void; title?: ReactNode; meta?: ReactNode; titleMenu?: ReactNode; }; export const CardHeader = ({ open, onToggle, title, meta, titleMenu }: CardHeaderProps) => { const chevron = ( ); const metaBlock = meta &&
{meta}
; if (!titleMenu) return ( ); return (
{titleMenu}
); }; export const CardBody = ({ children }: { children: ReactNode }) => (
{children}
); export const SubCard = ({ children }: { children: ReactNode }) => (
{children}
); // A folder header. When `onToggle` is supplied it becomes a collapse control (chevron + clickable // label); `action` stays a sibling so it never nests inside the toggle button. type SubCardHeaderProps = { icon?: ReactNode; label: ReactNode; title?: string; meta?: ReactNode; action?: ReactNode; open?: boolean; onToggle?: () => void; }; export const SubCardHeader = ({ icon, label, title, meta, action, open, onToggle }: SubCardHeaderProps) => { const inner = ( <> {onToggle && ( )} {icon} {label} {meta && {meta}} ); return (
{onToggle ? ( ) : ( inner )} {action}
); }; // File rows inside a SubCard, hairline-divided. export const RowList = ({ children }: { children: ReactNode }) => (
{children}
); type PillProps = { active: boolean; onClick: () => void; children: ReactNode }; export const Pill = ({ active, onClick, children }: PillProps) => ( );