diff --git a/gatsby-config.js b/gatsby-config.js index c45367c..746d28c 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -31,6 +31,13 @@ module.exports = { `gatsby-plugin-sharp`, `gatsby-transformer-sharp`, `gatsby-transformer-json`, + { + resolve: `gatsby-plugin-portal`, + options: { + key: "osnav", + id: "osnav", + }, + }, { resolve: `gatsby-plugin-remote-images`, options: { diff --git a/package.json b/package.json index 65ee006..bd19187 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "gatsby-plugin-manifest": "3.14.0", "gatsby-plugin-mdx": "2.14.0", "gatsby-plugin-offline": "4.14.0", + "gatsby-plugin-portal": "^1.0.7", "gatsby-plugin-react-helmet": "4.14.0", "gatsby-plugin-react-i18next": "1.1.1", "gatsby-plugin-remote-images": "3.1.1", diff --git a/src/components/navigation.js b/src/components/navigation.js index 1cb3846..a6a2a54 100644 --- a/src/components/navigation.js +++ b/src/components/navigation.js @@ -3,62 +3,10 @@ import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; import { Trans, Link } from "gatsby-plugin-react-i18next"; import { graphql, StaticQuery } from "gatsby"; -import { createPortal } from "react-dom"; import * as styles from "./navigation.module.scss"; -import { X } from "lucide-react"; import { Fade as Hamburger } from "hamburger-react"; - -const OffScreenNav = ({ active, close }) => { - if (typeof document === "undefined") return <>; - - return createPortal( -
-
- - - menu - - - home - - - about - - - projects - - - social - -
-
, - document.body - ); -}; - -OffScreenNav.propTypes = { - close: PropTypes.func.isRequired, - active: PropTypes.bool.isRequired, -}; +import OffScreenNav from "./offscreenNav"; const Navigation = ({ isHome }) => { let [atTop, setAtTop] = useState(false); @@ -109,11 +57,11 @@ const Navigation = ({ isHome }) => { (atTop ? " " + styles.homeBarTransparent : "") } > +