import "./Alert.css"; type AlertVariant = "info" | "success" | "error" | "warning"; const variantIcons: Record = { success: "✓", error: "✕", warning: "⚠", info: "ℹ", }; interface AlertProps { variant?: AlertVariant; title?: string; children: React.ReactNode; onClose?: () => void; className?: string; } const Alert = ({ variant = "info", title, children, onClose, className, }: AlertProps) => { const role = variant === "error" || variant === "warning" ? "alert" : "status"; const classNames = `alert alert-${variant}${className ? ` ${className}` : ""}`; return (
{variantIcons[variant]}
{title &&
{title}
}
{children}
{onClose && ( )}
); }; export default Alert;