import './card.css'; import type { ComponentChildren } from 'preact'; export function Card({ title, count, actions, tone, children, }: { title?: ComponentChildren; count?: number | string; actions?: ComponentChildren; tone?: 'accent' | 'danger'; children: ComponentChildren; }) { return (
{title ? (

{title} {count !== undefined ? {count} : null}

{actions ? {actions} : null}
) : null} {children}
); } export function Empty({ title, children }: { title: string; children?: ComponentChildren }) { return (
{title} {children ? {children} : null}
); } /** The one loading state: a spinner and a short line; `inline` keeps it to one line. */ export function Loading({ label, inline, dots, h, }: { label: string; inline?: boolean; /** Three pulsing dots instead of the ring, for a quiet wait. */ dots?: boolean; /** The height, in pixels, of what arrives in its place. */ h?: number; }) { const Tag = inline ? 'span' : 'div'; return ( {dots ? ( ) : ( )} {label} ); }