added useNotification @lib, using it in EventType (#468)
This commit is contained in:
1 parent
c963620a25
commit
a162949cf1
6 files changed
+77
-1
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function showToast(message: string, variant: "success" | "warning" | "error") {
|
||||
switch (variant) {
|
||||
case "success":
|
||||
toast.success(message, {
|
||||
duration: 6000,
|
||||
style: {
|
||||
borderRadius: "2px",
|
||||
background: "#333",
|
||||
color: "#fff",
|
||||
boxShadow: "none",
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "error":
|
||||
toast.error(message, {
|
||||
duration: 6000,
|
||||
style: {
|
||||
borderRadius: "2px",
|
||||
background: "#FEE2E2",
|
||||
color: "#B91C1C",
|
||||
boxShadow: "none",
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "warning":
|
||||
toast(message, {
|
||||
duration: 6000,
|
||||
style: {
|
||||
borderRadius: "2px",
|
||||
background: "#FFEDD5",
|
||||
color: "#C2410C",
|
||||
boxShadow: "none",
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
toast.success(message, {
|
||||
duration: 6000,
|
||||
style: {
|
||||
borderRadius: "2px",
|
||||
background: "#333",
|
||||
color: "#fff",
|
||||
boxShadow: "none",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user