import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect } from "react";
import { ToastContainer, toast } from "react-toastify";
import "../WelcomeToastComponent/style.scss";
const GenericToast = ({ showToast = false, delay = 5000, position = "top-right", hideProgressBar = false, pauseOnHover = false, draggable = false, closeButton = false, isLoading = false, toastLimit = 1, onClose = () => { }, children, }) => {
    const notify = () => {
        const toastId = toast(children, {
            position,
            autoClose: delay,
            hideProgressBar,
            closeOnClick: true,
            pauseOnHover,
            draggable,
            progress: undefined,
            theme: "dark",
            isLoading,
            onClose: () => {
                onClose();
                toast.dismiss(toastId);
            },
        });
    };
    useEffect(() => {
        if (showToast) {
            notify();
        }
    }, [showToast]);
    return (_jsx("div", { children: _jsx(ToastContainer, { limit: toastLimit, closeButton: closeButton }) }));
};
export default GenericToast;
