"use client" import { cn } from "@/lib/utils" import { AnimatePresence, motion } from "framer-motion" import { AlertTriangle, CheckCircle2, Info, X, XCircle } from "lucide-react" import { JSX, useState } from "react" type NoteVariant = "info" | "warning" | "success" | "error" | "neutral" interface NoteProps { variant?: NoteVariant title?: string children: React.ReactNode closable?: boolean onClose?: () => void className?: string } const variantStyles: Record< NoteVariant, { border: string; text: string; icon: JSX.Element } > = { info: { border: "border-blue-200 dark:border-blue-800", text: "text-blue-600 dark:text-blue-400", icon: , }, warning: { border: "border-amber-200 dark:border-amber-800", text: "text-amber-600 dark:text-amber-400", icon: , }, success: { border: "border-green-200 dark:border-green-800", text: "text-green-600 dark:text-green-400", icon: , }, error: { border: "border-red-600 dark:border-red-800", text: "text-red-600 dark:text-red-400", icon: , }, neutral: { border: "border-gray-200 dark:border-gray-700", text: "text-gray-600 dark:text-gray-400", icon: , }, } export function Note({ variant = "neutral", title, children, closable, onClose, className, }: NoteProps) { const [visible, setVisible] = useState(true) const style = variantStyles[variant] const handleClose = () => { setVisible(false) onClose?.() } return ( {visible && (
{style.icon}
{title && (

{title}

)}
{children}
{closable && ( )}
)}
) }