import classNames from "classnames";
import toast from "react-hot-toast";
import { Check, Info } from "../icon";
type IToast = {
message: string;
toastVisible: boolean;
toastId: string;
onClose: (toastId: string) => void;
};
export const SuccessToast = ({ message, toastVisible, onClose, toastId }: IToast) => (
);
export const ErrorToast = ({ message, toastVisible, onClose, toastId }: IToast) => (
);
export const WarningToast = ({ message, toastVisible, onClose, toastId }: IToast) => (
);
export const DefaultToast = ({ message, toastVisible, onClose, toastId }: IToast) => (
);
const TOAST_VISIBLE_DURATION = 6000;
export function showToast(
message: string,
variant: "success" | "warning" | "error",
duration = TOAST_VISIBLE_DURATION
) {
const onClose = (toastId: string) => {
toast.remove(toastId);
};
switch (variant) {
case "success":
return toast.custom(
(t) => ,
{ duration }
);
case "error":
return toast.custom(
(t) => ,
{ duration }
);
case "warning":
return toast.custom(
(t) => ,
{ duration }
);
default:
return toast.custom(
(t) => ,
{ duration }
);
}
}