error-toast.tsx 474 B

123456789101112131415161718192021
  1. import toast, { Toast } from "react-hot-toast";
  2. interface ErrorToastProps {
  3. id: Toast["id"];
  4. error: string;
  5. }
  6. export function ErrorToast({ id, error }: ErrorToastProps) {
  7. return (
  8. <div className="flex items-center justify-between w-full h-full">
  9. <span>{error}</span>
  10. <button
  11. type="button"
  12. onClick={() => toast.dismiss(id)}
  13. className="bg-neutral-500 px-1 rounded h-full"
  14. >
  15. Close
  16. </button>
  17. </div>
  18. );
  19. }