diff --git a/src/components/Alert.tsx b/src/components/Alert.tsx index 373cd94..76576fa 100644 --- a/src/components/Alert.tsx +++ b/src/components/Alert.tsx @@ -1,16 +1,33 @@ -import { InformationCircleIcon } from "@heroicons/react/24/solid"; +import { + ExclamationTriangleIcon, + InformationCircleIcon, +} from "@heroicons/react/24/solid"; +import { clsx } from "clsx"; export interface AlertProps { + sentiment?: "neutral" | "danger"; children?: React.ReactNode; } -export function Alert({ children }: AlertProps) { +const iconBySentiment = { + neutral: InformationCircleIcon, + danger: ExclamationTriangleIcon, +} satisfies Record, React.ComponentType>; + +export function Alert({ sentiment = "neutral", children }: AlertProps) { + const Icon = iconBySentiment[sentiment]; + return (
- +
{children}
);