import toast from 'react-hot-toast'
import {
XIcon,
CheckCircleIcon,
XCircleIcon,
AlertCircleIcon,
InfoIcon,
} from 'lucide-react'
import { twMerge } from 'tailwind-merge'
type Props = {
title?: string
description?: string
type?: 'default' | 'error' | 'success' | 'warning'
}
const renderIcon = (type: string) => {
switch (type) {
case 'warning':
return (
)
case 'error':
return (
)
case 'success':
return (
)
default:
return
}
}
export function toaster(props: Props) {
const { title, description, type = 'default' } = props
return toast.custom(
(t) => {
return (
{renderIcon(type)}
toast.dismiss(t.id)}
/>
)
},
{ id: 'toast', duration: 2000, position: 'top-right' }
)
}
export function snackbar(props: Props) {
const { description, type = 'default' } = props
return toast.custom(
(t) => {
return (
{renderIcon(type)}
{description}
toast.dismiss(t.id)}
/>
)
},
{ id: 'snackbar', duration: 2000, position: 'bottom-center' }
)
}