diff --git a/components/Navigation.js b/components/Navigation.js index 8b7ff1f..d6bcf29 100644 --- a/components/Navigation.js +++ b/components/Navigation.js @@ -101,10 +101,14 @@ const DownloadPopupTrigger = ({ setShowPopup }) => { export const DownloadPopup = ({ showPopup, setShowPopup }) => { const popupFirstFocus = useRef(null) + const [baseUrl, setBaseUrl] = useState("") useEffect(() => { // on popup open, focus on the first link popupFirstFocus.current.focus() + if (typeof window !== "undefined") { + setBaseUrl(window.location.origin) + } }, [showPopup]) return ( @@ -138,14 +142,14 @@ export const DownloadPopup = ({ showPopup, setShowPopup }) => { diff --git a/pages/blog/[blog].js b/pages/blog/[blog].js index f7cf1ac..8d4f5ef 100644 --- a/pages/blog/[blog].js +++ b/pages/blog/[blog].js @@ -1,5 +1,5 @@ -import React from "react" -import Navigation from "../../components/Navigation" +import React, { useState } from "react" +import Navigation, { DownloadPopup } from "../../components/Navigation" import Footer from "../../components/Footer" import { serialize } from "next-mdx-remote/serialize" import { MDXRemote } from "next-mdx-remote" @@ -11,6 +11,7 @@ import { HiChevronLeft } from "react-icons/hi" import styles from "../../style/bloga.module.css" const Blog = ({ mdxSource, data }) => { + const [showPopup, setShowPopup] = useState(false) return ( <>
@@ -20,7 +21,8 @@ const Blog = ({ mdxSource, data }) => { -