import type { FunctionComponent, ReactChild } from "react"; type AlertVariant = "error" | "success" | "info" | "warning"; type AlertVariantProps = { backgroundColor: string; titleTextColor: string; messageTextColor: string; }; type Props = { title: ReactChild; message: ReactChild; variant: AlertVariant; }; const ALERT_VARIANTS: Record = { error: { backgroundColor: "bg-red-50", titleTextColor: "text-red-800", messageTextColor: "text-red-700", }, success: { backgroundColor: "bg-green-50", titleTextColor: "text-green-800", messageTextColor: "text-green-700", }, info: { backgroundColor: "bg-primary-50", titleTextColor: "text-primary-800", messageTextColor: "text-primary-700", }, warning: { backgroundColor: "bg-yellow-50", titleTextColor: "text-yellow-800", messageTextColor: "text-yellow-700", }, }; const Alert: FunctionComponent = ({ title, message, variant }) => { const variantProperties = ALERT_VARIANTS[variant]; return (

{title}

{message}
); }; export default Alert;