Untitled

 avatar
unknown
plain_text
2 years ago
1.2 kB
6
Indexable
import "react-toastify/dist/ReactToastify.min.css";

import React, { useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Flip } from "react-toastify";
import { ToastContainer, toast as nativeToast, ToastContent, TypeOptions, ToastOptions } from "react-toastify";

import { Box } from "@mui/material";
import { CloseIcon, ToastErrorIcon, ToastSuccessIcon, ToastWarnIcon } from "@src/assets/svg";
import { ComponentWithChildren } from "@src/types";

import { useStyles } from "./toast.styles";
import "./toast.styles.ts";

type ToastContextType = {
  toast(type: TypeOptions, content: ToastContent, autoClose?: number): void;

};

const ToastContext = React.createContext<ToastContextType>({} as ToastContextType);

const ToastProvider: React.FC<ComponentWithChildren> = ({ children }) => {
  const toast = (type: TypeOptions, content: ToastContent, autoClose?: number) => {
    console.log(1);
  };

  return (
    <ToastContext.Provider value={{ toast }}>
      {children}
    </ToastContext.Provider>
  );
};

const useToastContext = () => React.useContext(ToastContext);

export { ToastProvider, useToastContext };
Editor is loading...