/* eslint-disable camelcase */
import { App } from "antd";
import { ReactNode } from "react";
import { ReactSVG } from "react-svg";

import icon_close from "../../../../assets/icons/icon_close.svg";

export default function useNotification() {
  const { notification } = App.useApp();

  const successTip = (tip: string | ReactNode, desc?: string | ReactNode) => {
    notification.success({
      message: tip,
      placement: "topRight",
      duration: 3,
      description: desc,
      closeIcon: <ReactSVG src={icon_close} className="icon_svg" />,
    });
  };
  const failedTip = (tip: string, desc?: string | ReactNode) => {
    notification.error({
      message: tip,
      placement: "topRight",
      duration: 3,
      description: desc,
      closeIcon: <ReactSVG src={icon_close} className="icon_svg" />,
    });
  };

  return {
    notification,
    successTip,
    failedTip,
  };
}
