From 2c74527bcaef16afc5f679fb675568bc33023a15 Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Thu, 10 Nov 2022 16:24:11 -0600 Subject: [PATCH] Update to Next 13 and all other dependencies. Fix Link tag, Script tag, Image tag, and custom Nav Link tag. --- components/Footer.js | 4 +--- components/Header.js | 4 +--- components/Nav.js | 28 +++++++--------------------- components/NavLink.js | 15 +++++---------- components/Page.js | 8 +------- pages/_app.js | 3 ++- pages/_document.js | 24 ++++++++++++++++++------ pages/photos.js | 2 +- 8 files changed, 36 insertions(+), 52 deletions(-) diff --git a/components/Footer.js b/components/Footer.js index 215d2c6..245d863 100644 --- a/components/Footer.js +++ b/components/Footer.js @@ -54,9 +54,7 @@ export default function Footer() {

- - N & N - + N & N

{user && user.isLoggedIn === true ? ( <> diff --git a/components/Header.js b/components/Header.js index 86c3391..f215379 100644 --- a/components/Header.js +++ b/components/Header.js @@ -31,9 +31,7 @@ const Header = () => {
- -

Name & Name

-
+

Name & Name

{user && user.isLoggedIn === true && !pastWeddingDate ? ( <> diff --git a/components/Nav.js b/components/Nav.js index cc10a97..ddc4fbf 100644 --- a/components/Nav.js +++ b/components/Nav.js @@ -4,27 +4,13 @@ import NavStyles from './styles/NavStyles'; export default function Nav() { return ( - - Home - - - Our Story - - - Wedding Party - - - Photos - - - Travel & Stay - - - Q & A - - - RSVP - + Home + Our Story + Wedding Party + Photos + Travel & Stay + Q & A + RSVP ); } diff --git a/components/NavLink.js b/components/NavLink.js index 60a42f7..272ec49 100644 --- a/components/NavLink.js +++ b/components/NavLink.js @@ -2,18 +2,13 @@ import React from 'react'; import Link from 'next/link'; import { useRouter } from 'next/router'; -export const NavLink = ({ children, href }) => { - const child = React.Children.only(children); - const router = useRouter(); +export const NavLink = ({ href, children }) => { + const { asPath } = useRouter(); + const ariaCurrent = href === asPath ? 'page' : undefined; return ( - - {React.cloneElement(child, { - 'aria-current': - router.pathname === href || router.pathname.includes(`${href}/`) - ? 'page' - : null, - })} + + {children} ); }; diff --git a/components/Page.js b/components/Page.js index 35f22a4..6258ae0 100644 --- a/components/Page.js +++ b/components/Page.js @@ -344,13 +344,7 @@ export default function Page({ children }) { - +
diff --git a/pages/_app.js b/pages/_app.js index ce2cc20..24c6f34 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -5,6 +5,7 @@ import { SWRConfig } from 'swr'; import Page from '../components/Page'; import '../components/styles/nprogress.css'; import fetch from '../lib/fetchJson'; +import Script from 'next/script'; Router.events.on('routeChangeStart', () => NProgress.start()); Router.events.on('routeChangeComplete', () => NProgress.done()); @@ -65,7 +66,7 @@ function MyApp({ Component, pageProps }) { as="font" crossOrigin="" /> -