File size: 641 Bytes
b59aa07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import toast, { Toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";

interface ErrorToastProps {
  id: Toast["id"];
  error: string;
}

export function ErrorToast({ id, error }: ErrorToastProps) {
  const { t } = useTranslation();

  return (
    <div className="flex items-center justify-between w-full h-full">
      <span>{error}</span>
      <button
        type="button"
        onClick={() => toast.dismiss(id)}
        className="bg-neutral-500 px-1 rounded h-full"
      >
        {t(I18nKey.ERROR_TOAST$CLOSE_BUTTON_LABEL)}
      </button>
    </div>
  );
}