From 2b8a68806215e363218e0ed3ba8e7a4d85aeda87 Mon Sep 17 00:00:00 2001 From: YoanRos Date: Tue, 19 Dec 2023 08:54:22 +0100 Subject: [PATCH 1/2] fix: popup download header icons --- components/Navigation.js | 8 ++++++-- pages/blog/[blog].js | 8 +++++--- pages/blog/index.js | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) 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 }) => { télécharger dans Google Play télécharger dans l'App Store 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 }) => { - + +
{ + const [showPopup, setShowPopup] = useState(false) return ( <> Blog | Oz Ensemble +
- +

From a1230d5d2c9baf1e19aec99d0b796ba18f25537d Mon Sep 17 00:00:00 2001 From: YoanRos Date: Fri, 22 Dec 2023 11:35:16 +0100 Subject: [PATCH 2/2] fix: index import --- pages/blog/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pages/blog/index.js b/pages/blog/index.js index 188d430..21fff7e 100644 --- a/pages/blog/index.js +++ b/pages/blog/index.js @@ -1,4 +1,4 @@ -import React from "react" +import React, { useState } from "react" import fs from "fs" import path from "path" import matter from "gray-matter" @@ -7,7 +7,6 @@ import Head from "next/head" import Navigation, { DownloadPopup } from "../../components/Navigation" import Footer from "../../components/Footer" import BlogCard from "../../components/BlogCard" -import { useState } from "react" const Index = ({ posts }) => { const [showPopup, setShowPopup] = useState(false)