import type { ReactNode } from "react"; import { cn } from "../../lib/cn"; export type AlertAction = { label: string; onClick: () => void; }; export type AlertProps = { action?: AlertAction; children?: ReactNode; className?: string; description?: ReactNode; dismissible?: boolean; onDismiss?: () => void; tone?: "info" | "success" | "warning" | "error" | "destructive"; title?: string; }; export function Alert({ action, children, className, description, dismissible = false, onDismiss, tone = "info", title, }: AlertProps) { const toneClasses = tone === "success" ? "border-[var(--uhuru-success-border)] bg-[var(--uhuru-success-bg)] text-[var(--uhuru-success-text)]" : tone === "warning" ? "border-[var(--uhuru-warning-border)] bg-[var(--uhuru-warning-bg)] text-[var(--uhuru-warning-text)]" : tone === "error" || tone === "destructive" ? "border-[var(--uhuru-error-border)] bg-[var(--uhuru-error-bg)] text-[var(--uhuru-error-text)]" : "border-[var(--uhuru-info-border)] bg-[var(--uhuru-info-bg)] text-[var(--uhuru-info-text)]"; const body = description ?? children; return (
{title}
: null} {body ? (