Refactor based on code review. Improved typing of useCookie hook. Added duration/delay to control length of toast.

This commit is contained in:
Dan Ditomaso
2025-01-14 21:51:06 -05:00
parent 07d4204e86
commit 7884991ac6
6 changed files with 221 additions and 143 deletions
+9 -3
View File
@@ -13,8 +13,14 @@ export function Toaster() {
return (
<ToastProvider>
{toasts.map(({ id, title, description, action, ...props }) => (
<Toast key={id} {...props} className="flex flex-col gap-4">
{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>}
@@ -26,4 +32,4 @@ export function Toaster() {
<ToastViewport />
</ToastProvider>
);
}
}