import type { ReactNode } from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '@utils/cn'; import { AlertCircle, CheckCircle, Info, XCircle, X } from 'lucide-react'; const alertVariants = cva( 'relative rounded-lg border p-4', { variants: { variant: { default: 'bg-gray-50 border-gray-200 text-gray-800', success: 'bg-success-50 border-success-200 text-success-800', warning: 'bg-warning-50 border-warning-200 text-warning-800', danger: 'bg-danger-50 border-danger-200 text-danger-800', info: 'bg-blue-50 border-blue-200 text-blue-800', }, }, defaultVariants: { variant: 'default', }, } ); const iconMap = { default: Info, success: CheckCircle, warning: AlertCircle, danger: XCircle, info: Info, }; export interface AlertProps extends VariantProps { title?: string; children: ReactNode; onClose?: () => void; className?: string; } export function Alert({ title, children, variant = 'default', onClose, className }: AlertProps) { const Icon = iconMap[variant || 'default']; return (
{title &&

{title}

}
{children}
{onClose && (
)}
); }