import Image from "next/image"; import type { CSSProperties, ReactNode } from "react"; import Link from "@/components/link"; const CARD_BORDER = "color-mix(in srgb, var(--color-text-muted) 10%, transparent)"; const CARD_DIVIDER = "color-mix(in srgb, var(--color-text-muted) 8%, transparent)"; const CARD_HEADER_BG = "linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 8%, var(--color-surface)), color-mix(in srgb, var(--color-primary) 4%, var(--color-surface)))"; export interface SurfaceCardProps { children: ReactNode; /** Optional header title. */ title?: string; /** Optional header icon (image URL). */ icon?: string; /** Optional header action link. */ actionHref?: string; actionLabel?: string; /** Class for the body wrapper (only used when a header is present). */ bodyClassName?: string; className?: string; style?: CSSProperties; } /** * The single public-site card component. Mirrors the CSS `.content-card` visual * language (--radius-lg corners, --shadow-card, hairline border). Pass `title` * / `icon` / `actionHref` to render a section header, exactly like the old * a card header. Without a header, children render directly so callers control * padding via `className`. */ export function SurfaceCard({ children, title, icon, actionHref, actionLabel, bodyClassName, className = "", style, }: SurfaceCardProps) { const hasHeader = Boolean(title || icon || (actionHref && actionLabel)); const CARD_SHADOW = "0 1px 2px rgba(0,0,0,0.05), 0 8px 24px -10px color-mix(in srgb, var(--color-text-muted) 22%, transparent), 0 0 0 0.5px color-mix(in srgb, var(--color-text-muted) 6%, transparent)"; return (
{hasHeader && (
{icon && (
)} {title && (

{title}

)}
{actionHref && actionLabel && ( {actionLabel} )}
)} {hasHeader ? (
{children}
) : ( children )}
); }