import type { ReactNode } from 'react'; import { AlertCircle, AlertTriangle, CheckCircle, Info } from 'lucide-react'; type AlertVariant = 'error' | 'warn' | 'success' | 'info'; interface AlertBannerProps { variant: AlertVariant; title?: string; children: ReactNode; } const CONFIG: Record = { error: { cls: 'alert-error', Icon: AlertCircle, role: 'alert' }, warn: { cls: 'alert-warn', Icon: AlertTriangle, role: 'alert' }, success: { cls: 'alert-success', Icon: CheckCircle, role: 'status' }, info: { cls: 'alert-info', Icon: Info, role: 'status' }, }; export function AlertBanner({ variant, title, children }: AlertBannerProps): JSX.Element { const { cls, Icon, role } = CONFIG[variant]; return (
{title ? {title} : null} {children}
); }