import { cn } from "~/utils/cn"; const PADDING = { none: "", sm: "p-3", md: "p-4", lg: "p-5", xl: "p-8" } as const; /** Card surface shared by `Panel` and ad-hoc containers (popovers, link cards). */ export function panelClass(className?: string): string { return cn("rounded-lg border border-gray-800 bg-gray-950/60", className); } type Props = { /** `danger` frames destructive settings (danger zone, transfers, renames). */ tone?: "neutral" | "danger"; title?: React.ReactNode; actions?: React.ReactNode; /** Inner padding. With a header, it pads the body below the header rather than the whole panel. */ padding?: keyof typeof PADDING; children: React.ReactNode; className?: string; }; export function Panel({ tone = "neutral", title, actions, padding = "none", children, className }: Props) { const hasHeader = Boolean(title || actions); return (
{hasHeader && (
{title}
{actions &&
{actions}
}
)} {hasHeader && padding !== "none" ?
{children}
: children}
); }