import Link from "next/link";
import type { ReactNode } from "react";
import { cx } from "@/lib/format";
export function Page({ children, className, wide }: { children: ReactNode; className?: string; wide?: boolean }) {
return
{children}
;
}
export function PageHeader({ title, lead, kicker, actions, className }: { title: ReactNode; lead?: ReactNode; kicker?: ReactNode; actions?: ReactNode; className?: string }) {
return (
{kicker &&
{kicker}
}
{title}
{lead &&
{lead}
}
{actions &&
{actions}
}
);
}
export function Section({ title, hint, href, hrefLabel = "View all", children, className, id, badge }: { title: ReactNode; hint?: ReactNode; href?: string; hrefLabel?: string; children: ReactNode; className?: string; id?: string; badge?: ReactNode }) {
return (
{title}
{badge}
{hint && {hint}}
{href && (
{hrefLabel} →
)}
{children}
);
}
export function Empty({ children, className }: { children: ReactNode; className?: string }) {
return {children}
;
}
export function Kv({ items, className, cols = 2 }: { items: Array<[ReactNode, ReactNode]>; className?: string; cols?: 1 | 2 | 3 | 4 }) {
return (
{items.map(([k, v], i) => (
- {k}
- {v}
))}
);
}
export function Stat({ label, value, sub, tone, className }: { label: ReactNode; value: ReactNode; sub?: ReactNode; tone?: "pos" | "neg" | "warn" | "muted"; className?: string }) {
return (
{label}
{value}
{sub &&
{sub}
}
);
}
export function Pill({ children, active, href, onClick }: { children: ReactNode; active?: boolean; href?: string; onClick?: () => void }) {
const cls = cx("inline-flex h-8 items-center whitespace-nowrap rounded-full border px-3 text-xs", active ? "border-ink bg-ink text-canvas" : "border-rule text-ink-2 hover:border-rule-strong hover:text-ink");
if (href)
return (
{children}
);
return (
);
}