import { cva } from "class-variance-authority"; import classNames from "classnames"; import type { ReactNode } from "react"; import { forwardRef } from "react"; import { Icon } from "../icon"; import type { IconName } from "../icon"; export const alertStyles = cva("rounded-[10px] p-3", { variants: { severity: { neutral: "bg-default border-subtle border-[1px] text-default", info: "bg-semantic-info-subtle text-semantic-info", warning: "bg-semantic-attention-subtle text-semantic-attention", error: "bg-semantic-error-subtle text-semantic-error", }, }, defaultVariants: { severity: "neutral", }, }); export interface AlertProps { title?: ReactNode; message?: ReactNode; actions?: ReactNode; className?: string; iconClassName?: string; severity: "warning" | "error" | "info" | "neutral"; CustomIcon?: IconName; customIconColor?: string; } export const Alert = forwardRef((props, ref) => { const { severity, iconClassName, CustomIcon, customIconColor } = props; return (
{CustomIcon ? (
) : (
{severity === "error" && (
)}
{props.title &&

{props.title}

} {props.message &&
{props.message}
}
{props.actions && (
{props.actions}
)}
); }); Alert.displayName = "Alert";