diff options
Diffstat (limited to 'frontend/components/ui/toaster.tsx')
| -rw-r--r-- | frontend/components/ui/toaster.tsx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/frontend/components/ui/toaster.tsx b/frontend/components/ui/toaster.tsx new file mode 100644 index 0000000..b5b97f6 --- /dev/null +++ b/frontend/components/ui/toaster.tsx | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | "use client" | ||
| 2 | |||
| 3 | import { | ||
| 4 | Toast, | ||
| 5 | ToastClose, | ||
| 6 | ToastDescription, | ||
| 7 | ToastProvider, | ||
| 8 | ToastTitle, | ||
| 9 | ToastViewport, | ||
| 10 | } from "@/components/ui/toast" | ||
| 11 | import { useToast } from "@/hooks/use-toast" | ||
| 12 | |||
| 13 | export function Toaster() { | ||
| 14 | const { toasts } = useToast() | ||
| 15 | |||
| 16 | return ( | ||
| 17 | <ToastProvider> | ||
| 18 | {toasts.map(function ({ id, title, description, action, ...props }) { | ||
| 19 | return ( | ||
| 20 | <Toast key={id} {...props}> | ||
| 21 | <div className="grid gap-1"> | ||
| 22 | {title && <ToastTitle>{title}</ToastTitle>} | ||
| 23 | {description && ( | ||
| 24 | <ToastDescription>{description}</ToastDescription> | ||
| 25 | )} | ||
| 26 | </div> | ||
| 27 | {action} | ||
| 28 | <ToastClose /> | ||
| 29 | </Toast> | ||
| 30 | ) | ||
| 31 | })} | ||
| 32 | <ToastViewport /> | ||
| 33 | </ToastProvider> | ||
| 34 | ) | ||
| 35 | } \ No newline at end of file | ||
