import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; import { AlertCircle, CheckCircle2, Info, TriangleAlert, X } from "lucide-react"; import { cn } from "@/lib/utils"; const alertVariants = cva( "relative flex w-full gap-3 rounded-xl border px-4 py-3 text-sm shadow-sm [&>svg]:shrink-0", { variants: { variant: { default: "border-border/80 bg-card text-foreground [&>svg]:text-muted-foreground", info: "border-[#0C447C]/25 bg-[#0C447C]/5 text-[#0C447C] [&>svg]:text-[#0C447C]", success: "border-[#0F6E56]/25 bg-[#E1F5EE] text-[#0F6E56] [&>svg]:text-[#0F6E56]", warning: "border-[#BA7517]/30 bg-amber-50 text-[#BA7517] [&>svg]:text-[#BA7517]", destructive: "border-[#A32D2D]/25 bg-red-50 text-[#A32D2D] [&>svg]:text-[#A32D2D]", }, }, defaultVariants: { variant: "default" }, } ); const iconByVariant = { default: Info, info: Info, success: CheckCircle2, warning: TriangleAlert, destructive: AlertCircle, } as const; export interface AlertProps extends React.HTMLAttributes, VariantProps { title?: string; onDismiss?: () => void; } const Alert = React.forwardRef( ({ className, variant = "default", title, onDismiss, children, ...props }, ref) => { const Icon = iconByVariant[variant ?? "default"]; return (
{title ?

{title}

: null} {children ? (
{children}
) : null}
{onDismiss ? ( ) : null}
); } ); Alert.displayName = "Alert"; export { Alert, alertVariants };