From 5a02adba85bc14a5ee03e71ad553ae07032b138f Mon Sep 17 00:00:00 2001 From: Marco Escaleira Date: Tue, 2 Jan 2024 12:15:19 +0000 Subject: [PATCH] fix: lodal modal container on client only --- src/components/Header/Header.tsx | 4 +++- src/components/Modal/DrawerLayout.tsx | 2 -- src/components/Modal/PopupLayout.tsx | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 0dc2bee..140faa9 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -4,6 +4,8 @@ import { ModalContainer } from "react-modal-global"; import { Modal, ModalType } from "@/components"; export function Header() { + let isClient = typeof window !== "undefined"; + return ( <>
@@ -16,7 +18,7 @@ export function Header() { />
- + {isClient && } ); } diff --git a/src/components/Modal/DrawerLayout.tsx b/src/components/Modal/DrawerLayout.tsx index c175be3..b1bb4db 100644 --- a/src/components/Modal/DrawerLayout.tsx +++ b/src/components/Modal/DrawerLayout.tsx @@ -25,5 +25,3 @@ export function DrawerLayout(props: DrawerLayoutProps) { ); } - -export default DrawerLayout; diff --git a/src/components/Modal/PopupLayout.tsx b/src/components/Modal/PopupLayout.tsx index 9047282..4edbfc4 100644 --- a/src/components/Modal/PopupLayout.tsx +++ b/src/components/Modal/PopupLayout.tsx @@ -25,5 +25,3 @@ export function PopupLayout(props: PopupLayoutProps) { ); } - -export default PopupLayout;