import { useEffect } from 'react' export interface ToastMsg { id: number kind: 'success' | 'error' | 'warning' text: string } const KIND_CLS: Record = { error: 'bg-pink shadow-[0_0_14px_rgb(255_122_154/0.6)]', warning: 'bg-gold shadow-[0_0_14px_rgb(255_200_97/0.6)]', success: 'bg-mint shadow-[0_0_14px_rgb(61_220_132/0.6)]', } export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: () => void }) { useEffect(() => { if (!toast) return const t = setTimeout(onClose, toast.kind === 'success' ? 4000 : 6000) return () => clearTimeout(t) }, [toast, onClose]) if (!toast) return null return (
{/* The glass carries no colour; a lit dot says which kind this is. */} {toast.text}
) }