cal/packages/lib/notification.ts
Omar López 558897fe53
Migrates components and libs to packages (#2172)
* Migrates Dialog to ui package

* Migrates Alert to ui

* Migrate Button to ui

* UI and lib migrations

* Add missing imports

* Update Error.tsx
2022-03-16 16:36:43 -07:00

50 lines
1.1 KiB
TypeScript

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",
},
});
}
}