'use client' import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from 'lucide-react' import { useEffect, useLayoutEffect, useRef, useState } from 'react' import type { ToastType, ToastProps } from 'uibee/components' export default function ToastItem({ toast, index, expanded, onRemove, onHeight, offset, frontHeight }: ToastProps) { const [mounted, setMounted] = useState(false) const ref = useRef(null) useEffect(() => { requestAnimationFrame(() => setMounted(true)) }, []) useLayoutEffect(() => { if (ref.current) { onHeight(toast.id, ref.current.offsetHeight) } }, [toast.message, onHeight, toast.id, expanded]) const isVisible = mounted && !toast.exiting const isFront = index === 0 const collapsedOffset = index * 10 + (index > 0 ? (frontHeight - 60) : 0) return (
  • {Icon(toast.type)}

    {toast.message}

  • ) } function Icon(type: ToastType) { switch (type) { case 'info': return case 'success': return case 'warning': return case 'error': return } }