'use client'
import { useEffect } from 'react'
import { CheckCircle, XCircle, AlertCircle, X } from 'lucide-react'
export type ToastType = 'success' | 'error' | 'info'
interface ToastProps {
message: string
type: ToastType
onClose: () => void
duration?: number
}
export default function Toast({ message, type, onClose, duration = 3000 }: ToastProps) {
useEffect(() => {
if (duration > 0) {
console.log(`[Toast] Setting timer for ${duration}ms`)
const timer = setTimeout(() => {
console.log('[Toast] Auto-dismissing')
onClose()
}, duration)
return () => {
console.log('[Toast] Clearing timer')
clearTimeout(timer)
}
}
}, [duration, onClose])
const icons = {
success:
{message}