'use client'; import type { MouseEventHandler, ReactNode } from 'react'; import Card from './Card'; interface PresetCardStat { label: string; value: string; } export interface PresetCardProps { title: string; subtitle?: string; primaryTag?: string; description?: string; stats?: PresetCardStat[]; selected?: boolean; disabled?: boolean; onSelect?: () => void; className?: string; children?: ReactNode; } export default function PresetCard({ title, subtitle, primaryTag, description, stats, selected, disabled, onSelect, className = '', children, }: PresetCardProps) { const isInteractive = typeof onSelect === 'function' && !disabled; const handleClick: MouseEventHandler = (event) => { if (!isInteractive) { return; } event.preventDefault(); onSelect?.(); }; const baseBorder = selected ? 'border-primary-blue' : 'border-charcoal-outline'; const baseBg = selected ? 'bg-primary-blue/10' : 'bg-iron-gray'; const baseRing = selected ? 'ring-2 ring-primary-blue/40' : ''; const disabledClasses = disabled ? 'opacity-60 cursor-not-allowed' : ''; const hoverClasses = isInteractive && !disabled ? 'hover:bg-iron-gray/80 hover:scale-[1.01]' : ''; const content = (
{title}
{subtitle && (
{subtitle}
)}
{primaryTag && ( {primaryTag} )} {selected && ( Selected )}
{description && (

{description}

)} {children} {stats && stats.length > 0 && (
{stats.map((stat) => (
{stat.label}
{stat.value}
))}
)}
); const commonClasses = `${baseBorder} ${baseBg} ${baseRing} ${hoverClasses} ${disabledClasses} ${className}`; if (isInteractive) { return ( ); } return ( } > {content} ); }