'use client' import { useEffect } from 'react' interface ToastProps { message: string type: 'success' | 'error' onClose: () => void action?: { label: string onClick: () => void } } export default function Toast({ message, type, onClose, action }: ToastProps) { useEffect(() => { // Don't auto-dismiss if there's an action button if (action) return const timer = setTimeout(() => { onClose() }, 3000) return () => clearTimeout(timer) }, [onClose, action]) const bgColor = type === 'success' ? 'bg-green-600 dark:bg-green-700' : 'bg-red-600 dark:bg-red-700' const icon = type === 'success' ? ( ) : ( ) return (
{icon} {message} {action && ( )}
) }