import Link from 'next/link'; import type { ReactNode } from 'react'; import { cn, deltaClass, fmtPct } from '@/lib/format'; /** Minimal, dense UI primitives. Keep them boring; the data is the design. */ export function Card({ children, className, as: Tag = 'section', id }: { children: ReactNode; className?: string; as?: 'section' | 'div' | 'article'; id?: string }) { return {children}; } export function CardHeader({ title, subtitle, action, className }: { title: ReactNode; subtitle?: ReactNode; action?: ReactNode; className?: string }) { return (

{title}

{subtitle ?

{subtitle}

: null}
{action ?
{action}
: null}
); } export function Delta({ value, digits = 2, className }: { value: number | null | undefined; digits?: number; className?: string }) { return {fmtPct(value, digits)}; } export function Badge({ children, tone = 'neutral', className }: { children: ReactNode; tone?: 'neutral' | 'gain' | 'loss' | 'index' | 'rarity' | 'alert' | 'gold'; className?: string }) { const tones: Record = { neutral: 'bg-inset text-muted', gain: 'bg-gain-bg text-gain', loss: 'bg-loss-bg text-loss', index: 'bg-index-bg text-index', rarity: 'bg-rarity-bg text-rarity', alert: 'bg-alert-bg text-alert', gold: 'bg-alert-bg text-gold', }; return {children}; } export function Stat({ label, value, sub, className }: { label: ReactNode; value: ReactNode; sub?: ReactNode; className?: string }) { return (
{label} {value} {sub ? {sub} : null}
); } export function EmptyState({ title, description, action, className }: { title: ReactNode; description?: ReactNode; action?: ReactNode; className?: string }) { return (

{title}

{description ?

{description}

: null} {action ?
{action}
: null}
); } /** Honest placeholder for metrics without enough evidence (§191–§192). */ export function Unavailable({ reason = 'Data unavailable', className }: { reason?: string; className?: string }) { return —; } export function SectionTitle({ children, href, hrefLabel = 'View all', className }: { children: ReactNode; href?: string; hrefLabel?: string; className?: string }) { return (

{children}

{href ? ( {hrefLabel} → ) : null}
); } export function Skeleton({ className }: { className?: string }) { return
; } export function Table({ children, className, dense = true }: { children: ReactNode; className?: string; dense?: boolean }) { return (
{children}
); } export const th = 'sticky top-0 z-[1] whitespace-nowrap border-b border-border bg-elevated px-3 py-2 text-[11px] font-medium uppercase tracking-wider text-subtle'; export const td = 'whitespace-nowrap border-b border-border px-3 py-2 align-middle'; export const tdNum = `${td} num text-right`;