"use client"; import React from "react"; import { CheckCircleIcon, InformationCircleIcon, ExclamationTriangleIcon, XCircleIcon, } from "@heroicons/react/24/outline"; type Variant = "success" | "info" | "warning" | "error"; type IconType = React.ComponentType>; const variantClasses: Record< Variant, { bg: string; border: string; text: string; icon: string; Icon: IconType } > = { success: { bg: "bg-success-soft", border: "border-success/30", text: "text-success", icon: "text-success", Icon: CheckCircleIcon, }, info: { bg: "bg-info-soft", border: "border-info/30", text: "text-info", icon: "text-info", Icon: InformationCircleIcon, }, warning: { bg: "bg-warning-soft", border: "border-warning/35", text: "text-foreground", icon: "text-warning", Icon: ExclamationTriangleIcon, }, error: { bg: "bg-danger-soft", border: "border-danger/30", text: "text-danger", icon: "text-danger", Icon: XCircleIcon, }, }; interface AlertBannerProps extends React.HTMLAttributes { variant?: Variant; title?: string; children?: React.ReactNode; icon?: React.ReactNode; size?: "sm" | "md"; elevated?: boolean; onClose?: () => void; } export function AlertBanner({ variant = "info", title, children, icon, size = "md", elevated = false, onClose, className, ...rest }: AlertBannerProps) { const styles = variantClasses[variant]; const Icon = styles.Icon; const padding = size === "sm" ? "p-3" : "p-4"; const radius = "rounded-xl"; const shadow = elevated ? "shadow-sm" : ""; const role = variant === "error" || variant === "warning" ? "alert" : "status"; return (
{icon ? icon : }
{title &&

{title}

} {children && (
{children}
)}
{onClose && ( )}
); } export type { AlertBannerProps };