import Link from "next/link"; import { useState, Fragment } from "react"; import { NavTemplate } from "../../layouts/NavTemplates"; import Image from "next/image"; import { AnimatePresence, m, Variants } from "framer-motion"; interface NavProps { options: NavTemplate[]; } function NavBar({ options }: NavProps) { const [navList, setNavList] = useState(options); const [isActive, setActive] = useState(false); return ( toffee logo
toffee

{ setActive(!isActive); }} > toffee

Serving anny's community est. 2022

{ setActive(!isActive); }} >
{navList.map((nav, index) => ( {nav.content} ))}

WIP

{isActive && ( {navList.map((nav, index) => ( { setActive(false); }} > {nav.content} ))} )}
); } // nav bar animation, fades in and then animates the children const containerVariants: Variants = { initial: { opacity: 1, }, animate: { opacity: 1, transition: { duration: 2, delayChildren: 0.5, staggerChildren: 0.25, }, }, }; // default animation for nav bar items const itemVariants: Variants = { initial: { opacity: 0, x: 100, }, animate: { opacity: 1, x: 0, }, }; // logo animation const logoContainerVariants: Variants = { initial: { scale: 1, rotate: -90, }, animate: { scale: 1, rotate: 0, transition: { duration: 4, type: "spring", stiffness: 15, }, }, }; // mobile nav bar container animation const mobileContainerVariants: Variants = { initial: { height: 0, }, animate: { height: "100vh", transition: { duration: 0.5, staggerChildren: 0.15, }, }, exit: { height: 0, transition: { duration: 0.3, }, }, }; // mobile nav bar item animation const mobileItemVariants: Variants = { initial: { opacity: 0, y: -150, }, animate: { opacity: 1, y: 0, transition: { duration: 0.7, type: "spring", bounce: 0.3, }, }, }; export default NavBar;