| 2 | import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from "@/components/ui/toast"; |
| 3 | |
| 4 | export function Toaster() { |
| 5 | const { toasts } = useToast(); |
| 6 | |
| 7 | return ( |
| 8 | <ToastProvider> |
| 9 | {toasts.map(function ({ id, title, description, action, ...props }) { |
| 10 | return ( |
| 11 | <Toast key={id} {...props}> |
| 12 | <div className="grid gap-1"> |
| 13 | {title && <ToastTitle>{title}</ToastTitle>} |
| 14 | {description && <ToastDescription>{description}</ToastDescription>} |
| 15 | </div> |
| 16 | {action} |
| 17 | <ToastClose /> |
| 18 | </Toast> |
| 19 | ); |
| 20 | })} |
| 21 | <ToastViewport /> |
| 22 | </ToastProvider> |
| 23 | ); |
| 24 | } |