You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
813 B
34 lines
813 B
import {
|
|
Toast,
|
|
ToastClose,
|
|
ToastDescription,
|
|
ToastProvider,
|
|
ToastTitle,
|
|
ToastViewport,
|
|
} from "@components/UI/Toast.tsx";
|
|
import { useToast } from "@core/hooks/useToast.ts";
|
|
|
|
export function Toaster() {
|
|
const { toasts } = useToast();
|
|
|
|
return (
|
|
<ToastProvider>
|
|
{toasts.map(({ id, title, description, action, duration, ...props }) => (
|
|
<Toast
|
|
key={id}
|
|
{...props}
|
|
duration={duration}
|
|
className="flex flex-col gap-4"
|
|
>
|
|
<div className="grid gap-1">
|
|
{title && <ToastTitle>{title}</ToastTitle>}
|
|
{description && <ToastDescription>{description}</ToastDescription>}
|
|
</div>
|
|
{action}
|
|
<ToastClose />
|
|
</Toast>
|
|
))}
|
|
<ToastViewport />
|
|
</ToastProvider>
|
|
);
|
|
}
|
|
|