import { ReactNode } from 'react' import { cn, surfaces } from '@/lib/theme' type CardVariant = keyof typeof surfaces.card type SectionVariant = keyof typeof surfaces.section interface CardProps { children: ReactNode title?: ReactNode variant?: CardVariant | SectionVariant className?: string spanCols?: number onClick?: () => void } /** * Versatile card component with optional title and column spanning. * * Supports both card and section variants from the theme system. * Can display an optional title (string or ReactNode with icons) and span multiple grid columns. * * @example * ```tsx * // Simple card * Content * * // Section card with title * Content * * // Card with icon in title * Title}> * Content * * * // Card spanning 2 columns * Wide content * ``` */ export function Card({ children, title, variant = 'default', className, spanCols, onClick }: CardProps) { let variantClass: string if (variant in surfaces.card) { variantClass = surfaces.card[variant as CardVariant] } else if (variant in surfaces.section) { variantClass = surfaces.section[variant as SectionVariant] } else { variantClass = surfaces.card.default } const colSpanClass = spanCols ? `lg:col-span-${spanCols}` : '' return (
{title && (

{title}

)} {children}
) }