import { CheckCircle2, AlertTriangle, Info, XCircle, X, Bell } from 'lucide-react'; import { motion } from 'framer-motion'; const categoryConfig = { success: { icon: CheckCircle2, bg: 'bg-emerald-950/60', border: 'border-emerald-400/15', iconBg: 'bg-emerald-400/12', iconColor: 'text-emerald-400', title: 'text-emerald-300', glow: 'shadow-emerald-500/10', progress: 'bg-emerald-400/40', }, error: { icon: XCircle, bg: 'bg-red-950/60', border: 'border-red-400/15', iconBg: 'bg-red-400/12', iconColor: 'text-red-400', title: 'text-red-300', glow: 'shadow-red-500/10', progress: 'bg-red-400/40', }, warning: { icon: AlertTriangle, bg: 'bg-amber-950/60', border: 'border-amber-400/15', iconBg: 'bg-amber-400/12', iconColor: 'text-amber-400', title: 'text-amber-300', glow: 'shadow-amber-500/10', progress: 'bg-amber-400/40', }, info: { icon: Info, bg: 'bg-blue-950/60', border: 'border-blue-400/15', iconBg: 'bg-blue-400/12', iconColor: 'text-blue-400', title: 'text-blue-300', glow: 'shadow-blue-500/10', progress: 'bg-blue-400/40', }, neutral: { icon: Bell, bg: 'bg-zinc-900/80', border: 'border-zinc-400/15', iconBg: 'bg-zinc-400/12', iconColor: 'text-zinc-400', title: 'text-zinc-300', glow: 'shadow-zinc-500/10', progress: 'bg-zinc-400/40', }, }; const positionStyles = { 'top-left': 'items-start justify-start', 'top-center': 'items-start justify-center', 'top-right': 'items-start justify-end', 'bottom-left': 'items-end justify-start', 'bottom-center': 'items-end justify-center', 'bottom-right': 'items-end justify-end', 'center': 'items-center justify-center', }; export default function AlertCard({ id, category, title, message, position, dismissible, autoClose, duration, onDismiss, animationVariant, }) { const config = categoryConfig[category] || categoryConfig.neutral; const Icon = config.icon; const variants = { slideIn: { hidden: { x: 100, opacity: 0, scale: 0.9 }, visible: { x: 0, opacity: 1, scale: 1, transition: { type: 'spring', stiffness: 350, damping: 25 } }, exit: { x: 100, opacity: 0, scale: 0.9, transition: { duration: 0.25 } }, }, slideInLeft: { hidden: { x: -100, opacity: 0, scale: 0.9 }, visible: { x: 0, opacity: 1, scale: 1, transition: { type: 'spring', stiffness: 350, damping: 25 } }, exit: { x: -100, opacity: 0, scale: 0.9, transition: { duration: 0.25 } }, }, slideUp: { hidden: { y: 60, opacity: 0 }, visible: { y: 0, opacity: 1, transition: { type: 'spring', stiffness: 350, damping: 25 } }, exit: { y: 60, opacity: 0, transition: { duration: 0.25 } }, }, slideDown: { hidden: { y: -60, opacity: 0 }, visible: { y: 0, opacity: 1, transition: { type: 'spring', stiffness: 350, damping: 25 } }, exit: { y: -60, opacity: 0, transition: { duration: 0.25 } }, }, fade: { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.35 } }, exit: { opacity: 0, transition: { duration: 0.2 } }, }, scale: { hidden: { scale: 0.7, opacity: 0 }, visible: { scale: 1, opacity: 1, transition: { type: 'spring', stiffness: 400, damping: 20 } }, exit: { scale: 0.7, opacity: 0, transition: { duration: 0.2 } }, }, bounce: { hidden: { scale: 0.5, opacity: 0 }, visible: { scale: 1, opacity: 1, transition: { type: 'spring', stiffness: 500, damping: 12 } }, exit: { scale: 0.5, opacity: 0, transition: { duration: 0.2 } }, }, elastic: { hidden: { scale: 0.3, opacity: 0, x: 40 }, visible: { scale: 1, opacity: 1, x: 0, transition: { type: 'spring', stiffness: 260, damping: 12 } }, exit: { scale: 0.3, opacity: 0, x: -40, transition: { duration: 0.3 } }, }, flip: { hidden: { rotateX: -90, opacity: 0 }, visible: { rotateX: 0, opacity: 1, transition: { duration: 0.5, ease: 'easeOut' } }, exit: { rotateX: 90, opacity: 0, transition: { duration: 0.3 } }, }, swing: { hidden: { rotate: -15, opacity: 0, y: 30 }, visible: { rotate: 0, opacity: 1, y: 0, transition: { type: 'spring', stiffness: 300, damping: 15 } }, exit: { rotate: 15, opacity: 0, y: -30, transition: { duration: 0.3 } }, }, zoomBounce: { hidden: { scale: 0.1, opacity: 0 }, visible: { scale: 1, opacity: 1, transition: { type: 'spring', stiffness: 200, damping: 10, restDelta: 0.001, }, }, exit: { scale: 0.1, opacity: 0, transition: { duration: 0.25 } }, }, }; const variant = variants[animationVariant] || variants.slideIn; return (

{title}

{message}

{dismissible && ( )}
{autoClose && (
)}
); }