import Link from 'next/link';
import type { ReactNode } from 'react';
import { cn } from '@/lib/format';
export interface TabDef {
id: string;
label: ReactNode;
count?: number | null;
href: string;
}
/** Server-rendered, URL-driven tabs (no client state; deep-linkable; works without JS). */
export function Tabs({ tabs, active, className }: { tabs: TabDef[]; active: string; className?: string }) {
return (
{tabs.map((t) => {
const isActive = t.id === active;
return (
{t.label}
{t.count !== undefined && t.count !== null ? {t.count.toLocaleString('en-US')} : null}
);
})}
);
}
/** Pill group for period selectors etc. */
export function Segmented({ options, active, className }: { options: Array<{ id: string; label: string; href: string }>; active: string; className?: string }) {
return (
{options.map((o) => (
{o.label}
))}
);
}