import { type ReactNode } from "react"; import { HiCheckCircle, HiInformationCircle, HiXCircle, HiXMark } from "react-icons/hi2"; import { twMerge } from "tailwind-merge"; export type InfoMessageType = "success" | "error" | "info"; const InfoMessage = ({ message, type, className, onDismiss, }: { message: ReactNode; type: "success" | "error" | "info"; onDismiss?: () => void; className?: string; }) => { const icons = { success: HiCheckCircle, error: HiXCircle, info: HiInformationCircle, }; const colorClasses = { success: { text: "text-success", bg: "bg-success/30", button: "bg-transparent hover:bg-success hover:text-white focus:ring-success focus:ring-offset-success/50", }, error: { text: "text-error", bg: "bg-error/30", button: "bg-transparent hover:bg-error hover:text-white focus:ring-error focus:ring-offset-error/50", }, info: { text: "text-primary", bg: "bg-primary/30", button: "bg-transparent hover:bg-primary-800 hover:text-white focus:ring-primary-800 focus:ring-offset-primary-50", }, }; const Icon = icons[type]; const { text, bg, button } = colorClasses[type]; return (
{message}