From f7101ecb03b87dd35af19dfcc8f26af573f3147a Mon Sep 17 00:00:00 2001 From: "Jason R. Stevens, CFA" Date: Tue, 1 Feb 2022 14:23:31 -0600 Subject: [PATCH 1/3] :recycle: add mobile nav passing down state via parent index render [sc-634] --- components/MobileNavbar.jsx | 175 ++++++++++++++++--------- components/MobileNavigationItem.jsx | 22 ++-- components/Navbar.jsx | 9 +- components/Sections/NavigationHero.jsx | 6 + pages/index.jsx | 4 +- 5 files changed, 140 insertions(+), 76 deletions(-) diff --git a/components/MobileNavbar.jsx b/components/MobileNavbar.jsx index 162ab24..e6d5c36 100644 --- a/components/MobileNavbar.jsx +++ b/components/MobileNavbar.jsx @@ -1,76 +1,123 @@ import MobileNavigationItem from "./MobileNavigationItem"; +import { signIn, signOut } from "next-auth/react"; +import Link from "next/link"; + export default function MobileNavbar({ entityTitle, navigationLinks, navigationHrefs, cta, session, + mobileMenuIsClicked, + setMobileMenuIsClicked, }) { return ( -
-
- +
+ {" "} + {!mobileMenuIsClicked ? ( + <> +
+ + + + ) : null}
); } diff --git a/components/MobileNavigationItem.jsx b/components/MobileNavigationItem.jsx index 16f14f3..5b0ee6b 100644 --- a/components/MobileNavigationItem.jsx +++ b/components/MobileNavigationItem.jsx @@ -1,13 +1,17 @@ import Link from "next/link"; -export default function MobileNavigationItem({ href, children }) { +export default function MobileNavigationItem({ + href, + mobileMenuIsClicked, + setMobileMenuIsClicked, + children, +}) { return ( - - - {children} - - + setMobileMenuIsClicked(!mobileMenuIsClicked)} + > + {children} + ); } diff --git a/components/Navbar.jsx b/components/Navbar.jsx index a1af0a6..7959f99 100644 --- a/components/Navbar.jsx +++ b/components/Navbar.jsx @@ -8,6 +8,8 @@ export default function Navbar({ cta, logoSrc, session, + mobileMenuIsClicked, + setMobileMenuIsClicked, }) { const [first, last] = [entityTitle?.slice(0, 1), entityTitle?.slice(1)]; @@ -32,9 +34,12 @@ export default function Navbar({ )}
-
- +
+ +
); }