update ui components

This commit is contained in:
Philipinho
2023-09-02 16:38:50 +01:00
parent b8f6c17cf0
commit f2cbd0c19b
15 changed files with 902 additions and 364 deletions

View File

@ -0,0 +1,21 @@
"use client";
import t, { Toaster, useToasterStore } from "react-hot-toast";
import { useEffect, useState } from "react";
export default function CustomToaster() {
const { toasts } = useToasterStore();
const TOAST_LIMIT = 3;
const [toastLimit, setToastLimit] = useState<number>(TOAST_LIMIT);
useEffect(() => {
toasts
.filter((tt) => tt.visible)
.filter((_, i) => i >= toastLimit)
.forEach((tt) => {
t.dismiss(tt.id);
});
}, [toastLimit, toasts]);
return <Toaster position={"top-right"}/>;
};