Files
Checkmate/Client/src/Utils/toastUtils.jsx
T

26 lines
544 B
React
Raw Normal View History

2024-07-11 18:05:41 -04:00
import { toast } from "react-toastify";
import Alert from "../Components/Alert";
export const createToast = ({ variant, title, body, hasIcon, config = {} }) => {
const toastConfig = {
2024-07-11 18:53:14 -04:00
position: "bottom-right",
2024-07-11 18:05:41 -04:00
autoClose: 3000,
hideProgressBar: true,
closeButton: false,
...config,
};
toast(
({ closeToast }) => (
<Alert
variant={variant}
title={title}
body={body}
isToast={true}
hasIcon={hasIcon}
onClick={closeToast}
/>
),
toastConfig
);
};