import { Button, IconButton, Paper, Stack, Typography } from '@mui/material'; import React, { useRef } from 'react' import toast, { Toaster } from 'react-hot-toast' import CloseIcon from "@mui/icons-material/Close"; import { CustomPaperRefer } from './CustomToaster.style'; import { useEffect } from 'react'; const CustomToast = ({ title, description, icon }) => ( {icon && (icon)} {title} {description} toast.dismiss()}> ); // Function to show the custom toast const showToast = ({ title, description, icon, position }) => { toast.custom((t) => , { position: position, duration: 5000, }); }; // Usage example const CustomToaster = (props) => { const { title, description, icon, position, isOpen } = props; const initialRender = useRef(true); useEffect(() => { if (initialRender.current) { initialRender.current = false; return; } if (isOpen) { handleShowToast(); } }, [isOpen]) const handleShowToast = () => { showToast({ title: title, description: description, icon: icon, position: position, }); }; return ( ) } export default CustomToaster; {/* } position="top-right" /> */} // Positions // "top-left" // "top-center" // "top-right" // "bottom-left" // "bottom-center" // "bottom-right"