summaryrefslogtreecommitdiff
path: root/apps/web/src/components/ui/toaster.tsx
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-06-22 10:02:50 +0200
committerMaze Winther <mazewinther@gmail.com>2025-06-22 10:02:50 +0200
commit87a83a5604b20550430ef4eefbcd573d309694e2 (patch)
tree7ed86f00b8414cb6543f5c5ac98ea6e9abd2e10f /apps/web/src/components/ui/toaster.tsx
downloadopencut-87a83a5604b20550430ef4eefbcd573d309694e2.tar.gz
Initial commit
Diffstat (limited to 'apps/web/src/components/ui/toaster.tsx')
-rw-r--r--apps/web/src/components/ui/toaster.tsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/web/src/components/ui/toaster.tsx b/apps/web/src/components/ui/toaster.tsx
new file mode 100644
index 00000000..3eb8a720
--- /dev/null
+++ b/apps/web/src/components/ui/toaster.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { useToast } from "../../hooks/use-toast";
+import {
+ Toast,
+ ToastClose,
+ ToastDescription,
+ ToastProvider,
+ ToastTitle,
+ ToastViewport,
+} from "./toast";
+
+export function Toaster() {
+ const { toasts } = useToast();
+
+ return (
+ <ToastProvider>
+ {toasts.map(function ({ id, title, description, action, ...props }) {
+ return (
+ <Toast key={id} {...props}>
+ <div className="grid gap-1">
+ {title && <ToastTitle>{title}</ToastTitle>}
+ {description && (
+ <ToastDescription>{description}</ToastDescription>
+ )}
+ </div>
+ {action}
+ <ToastClose />
+ </Toast>
+ );
+ })}
+ <ToastViewport />
+ </ToastProvider>
+ );
+}