From 4b0487e3006e4de680c0536eb05ff9b7a1b897bc Mon Sep 17 00:00:00 2001 From: Kevin Kandlbinder Date: Mon, 18 Oct 2021 17:32:38 +0200 Subject: [PATCH] Fix navigation --- src/components/navigation.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/navigation.js b/src/components/navigation.js index 2c7743c..1cb3846 100644 --- a/src/components/navigation.js +++ b/src/components/navigation.js @@ -10,14 +10,12 @@ import { X } from "lucide-react"; import { Fade as Hamburger } from "hamburger-react"; const OffScreenNav = ({ active, close }) => { - if (typeof window === "undefined") { - return null; - } + if (typeof document === "undefined") return <>; return createPortal(
@@ -53,10 +51,15 @@ const OffScreenNav = ({ active, close }) => {
, - window.document.body + document.body ); }; +OffScreenNav.propTypes = { + close: PropTypes.func.isRequired, + active: PropTypes.bool.isRequired, +}; + const Navigation = ({ isHome }) => { let [atTop, setAtTop] = useState(false); const [offscreenNavActive, setOffscreenNavActive] = useState(false);