Skip to content

Commit

Permalink
fix: lodal modal container on client only
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoEscaleira committed Jan 2, 2024
1 parent cf8dabd commit 5a02adb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ModalContainer } from "react-modal-global";
import { Modal, ModalType } from "@/components";

export function Header() {
let isClient = typeof window !== "undefined";

return (
<>
<header className="absolute left-0 top-0 z-10 w-full px-4 py-2 sm:px-6 sm:py-4">
Expand All @@ -16,7 +18,7 @@ export function Header() {
/>
</div>
</header>
<ModalContainer controller={Modal} />
{isClient && <ModalContainer controller={Modal} />}
</>
);
}
2 changes: 0 additions & 2 deletions src/components/Modal/DrawerLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ export function DrawerLayout(props: DrawerLayoutProps) {
</div>
);
}

export default DrawerLayout;
2 changes: 0 additions & 2 deletions src/components/Modal/PopupLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ export function PopupLayout(props: PopupLayoutProps) {
</div>
);
}

export default PopupLayout;

0 comments on commit 5a02adb

Please sign in to comment.