Added create toast function

This commit is contained in:
Daniel Cojocea committed 2024-07-11 18:05:41 -04:00
1 parent e9cb0aa339
commit 92d4caa801
4 files changed
+55 -4

No files matched your search

+3 -3
View File
@@ -109,9 +109,9 @@ const theme = createTheme({
border: "#f04438",
},
warning: {
color: "#f79009",
bg: "#fffaef",
border: "#fecf60"
color: "#DC6803",
bg: "#fffcf5",
border: "#fec84b"
},
},
});
+26
View File
@@ -0,0 +1,26 @@
import { toast } from "react-toastify";
import Alert from "../Components/Alert";
export const createToast = ({ variant, title, body, hasIcon, config = {} }) => {
const toastConfig = {
position: "top-right",
autoClose: 3000,
hideProgressBar: true,
closeButton: false,
...config,
};
toast(
({ closeToast }) => (
<Alert
variant={variant}
title={title}
body={body}
isToast={true}
hasIcon={hasIcon}
onClick={closeToast}
/>
),
toastConfig
);
};