import React, { useEffect } from "react" import type { Toast } from "react-hot-toast" import CrossIcon from "../../fundamentals/icons/cross-icon" import XCircleIcon from "../../fundamentals/icons/x-circle-icon" import ToasterContainer from "../toaster-container" type SavingStateProps = { toast: Toast title?: string message?: string onDismiss: () => void } const ErrorState: React.FC = ({ toast, title = "Error", message = "An error occured while trying to save your changes. Please try again.", onDismiss, }) => { useEffect(() => { const life = setTimeout(() => { onDismiss() }, 2000) return () => { clearTimeout(life) } }, [toast]) return (
{title} {message}
Close
) } export default ErrorState