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

26 lines
541 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 = {
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
);
};