From 0a6b969902ef4b93c95aaaf839c52fdfdedf8796 Mon Sep 17 00:00:00 2001 From: 3zachm <3zachn4@gmail.com> Date: Mon, 12 Dec 2022 04:25:11 -0800 Subject: [PATCH] navbar good enough --- components/common/NavBar.tsx | 60 +++++++++++++++++++++++------------- layouts/NavTemplates.tsx | 39 +++++++++++------------ 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/components/common/NavBar.tsx b/components/common/NavBar.tsx index e524e45..01a3d52 100644 --- a/components/common/NavBar.tsx +++ b/components/common/NavBar.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; import { useState, Fragment } from "react"; import { NavTemplate } from "../../layouts/NavTemplates"; import Image from "next/image"; -import { m, Variants } from "framer-motion"; +import { AnimatePresence, m, Variants } from "framer-motion"; interface NavProps { options: NavTemplate[]; @@ -37,16 +37,16 @@ const itemAnimation: Variants = { function NavBar({ options }: NavProps) { const [navList, setNavList] = useState(options); - const [active, setActive] = useState(false); + const [isActive, setActive] = useState(false); return ( { - setActive(!active); - console.log(active); + setActive(!isActive); }} >

- Login blah + Login WIP

- - {navList.map((nav, index) => ( - // TODO: stylize -- I have a flight in 4 hours and its 3:04 am - {nav.content} - ))} - + + {isActive && ( + + {navList.map((nav, index) => ( + { + setActive(false); + }} + > + {nav.content} + + ))} + + )} +
); } diff --git a/layouts/NavTemplates.tsx b/layouts/NavTemplates.tsx index 1f2fe5e..63e888c 100644 --- a/layouts/NavTemplates.tsx +++ b/layouts/NavTemplates.tsx @@ -10,28 +10,29 @@ const DefaultNavOption = ({ href: string; }): ReactElement => { return ( - - + +

{label}

- -
+
+ ); };