import { createPortal } from "react-dom"; import { useToast } from "../hooks/useToast"; import { CheckCircleIcon, WarningCircleIcon, InfoIcon } from "@phosphor-icons/react"; const ICONS = { success: , error: , info: }; const BORDERS = { success: "border-green-500/30", error: "border-kumo-danger", info: "border-blue-500/30" }; export function Toaster() { const { toasts } = useToast(); if (toasts.length === 0) return null; return createPortal(
{toasts.map((t) => (
{ICONS[t.kind]} {t.message}
))}
, document.body ); }