OpChan/app/src/components/ui/toaster.tsx

34 lines
777 B
TypeScript
Raw Normal View History

2025-08-30 18:34:50 +05:30
import { useToast } from '@/hooks/use-toast';
2025-04-15 16:28:03 +05:30
import {
Toast,
ToastClose,
ToastDescription,
ToastProvider,
ToastTitle,
ToastViewport,
2025-08-30 18:34:50 +05:30
} from '@/components/ui/toast';
2025-04-15 16:28:03 +05:30
export function Toaster() {
2025-08-30 18:34:50 +05:30
const { toasts } = useToast();
2025-04-15 16:28:03 +05:30
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>
2025-08-30 18:34:50 +05:30
);
2025-04-15 16:28:03 +05:30
})}
<ToastViewport />
</ToastProvider>
2025-08-30 18:34:50 +05:30
);
2025-04-15 16:28:03 +05:30
}