'use client'; import React, { ReactNode } from 'react'; import { toast as sonnerToast } from 'sonner'; import { CheckCircleFillIcon, WarningIcon } from './icons'; const iconsByType: Record<'success' | 'error', ReactNode> = { success: , error: , }; export function toast(props: Omit) { return sonnerToast.custom((id) => ( )); } function Toast(props: ToastProps) { const { id, type, description } = props; return (
{iconsByType[type]}
{description}
); } interface ToastProps { id: string | number; type: 'success' | 'error'; description: string; }