diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index cdf4dff..17dc931 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -1,194 +1,208 @@ -"use client"; +'use client' -import { tedxsjecAssetsPrefix } from "@/lib/utils"; -import { useGSAP } from "@gsap/react"; -import gsap from "gsap"; -import Image from "next/image"; -import Link from "next/link"; -import React, { useRef } from "react"; -import { Button } from "../ui/button"; +import { tedxsjecAssetsPrefix } from "@/lib/utils" +import { useGSAP } from "@gsap/react" +import gsap from "gsap" +import Image from "next/image" +import Link from "next/link" +import React, { useRef, useState } from "react" +import { Button } from "../ui/button" const Navbar = () => { - const menuBar = useRef(gsap.timeline({ paused: true })); - const tl = useRef(gsap.timeline({ paused: true })); - const menuToggleRef = useRef(null); + const menuBar = useRef(gsap.timeline({ paused: true })) + const tl = useRef(gsap.timeline({ paused: true })) + const menuToggleRef = useRef(null) + const [isMenuOpen, setIsMenuOpen] = useState(false) - useGSAP(() => { - menuBar.current - .to( - ".bar-1", - 2, - { - attr: { d: "M8,2 L2,8" }, - stroke: "#000", - x: 1, - ease: "Power2.easeInOut", - }, - "start" - ) - .to(".bar-2", 2, { autoAlpha: 0, stroke: "#000" }, "start") - .to( - ".bar-3", - 2, - { - attr: { d: "M8,8 L2,2" }, - x: 1, - stroke: "#000", - ease: "Power2.easeInOut", - }, - "start" - ); + useGSAP(() => { + menuBar.current + .to( + ".bar-1", + 0.5, + { + attr: { d: "M8,2 L2,8" }, + stroke: "#000", + x: 1, + ease: "Power2.easeInOut", + }, + "start" + ) + .to(".bar-2", 0.5, { autoAlpha: 0, stroke: "#000" }, "start") + .to( + ".bar-3", + 0.5, + { + attr: { d: "M8,8 L2,2" }, + x: 1, + stroke: "#000", + ease: "Power2.easeInOut", + }, + "start" + ) - tl.current - .to(".logo", { x: -300 }, "go") - .to(".reg", { y: -300 }, "go") - .to(".fullpage-menu", { - duration: 0, - display: "block", - ease: "Expo.easeInOut", - }) - .from(".menu-bg span", { - duration: 0.3, - x: "100%", - stagger: 0.1, - ease: "Expo.easeInOut", - }) - .from(".header-2", { x: -300 }) - .from(".listo", { duration: 0.3, x: "-50%", stagger: 0.1, opacity: 0 }, "-=0.5") - .from(".hero-icon", { scale: 0, duration: 0.5 }, "end") - .from(".life", { x: 800, duration: 0.5 }, "end"); + tl.current + .to(".logo", { x: -300, duration: 0.5 }, "go") + .to(".reg", { y: -300, duration: 0.5 }, "go") + .to(".fullpage-menu", { + duration: 0.1, + display: "block", + ease: "Expo.easeInOut", + }) + .from(".menu-bg span", { + duration: 0.5, + x: "100%", + stagger: 0.1, + ease: "Expo.easeInOut", + }) + .from(".header-2", { x: -300, duration: 0.5 }) + .from(".listo", { + duration: 0.5, + x: "-50%", + stagger: 0.1, + opacity: 0, + ease: "Power2.easeOut" + }, "-=0.5") + .from(".hero-icon", { scale: 0, duration: 0.5 }, "end") + .from(".life", { + x: 800, + duration: 0.5, + opacity: 0, + ease: "Power2.easeOut" + }, "end") - menuBar.current.reverse(); - tl.current.reverse(); - }, []); + menuBar.current.reverse() + tl.current.reverse() + }, []) - const handleClick = () => { - menuBar.current.reversed(!menuBar.current.reversed()); - tl.current.reversed(!tl.current.reversed()); - }; + const handleClick = () => { + menuBar.current.reversed(!menuBar.current.reversed()) + tl.current.reversed(!tl.current.reversed()) + setIsMenuOpen(!isMenuOpen) + } - const NavItem = ({ href, textOne, textTwo }: { href: string; textOne: string; textTwo: string }) => ( -
  • - - - -
  • - ); + const NavItem = ({ href, textOne, textTwo }: { href: string; textOne: string; textTwo: string }) => ( +
  • + + + +
  • + ) - const TextGlitch = ({ - textOne, - textTwo, - className, - }: { - textOne: string; - textTwo: string; - className: string; - }) => ( - - {textOne} - {textTwo} - - ); + const TextGlitch = ({ + textOne, + textTwo, + className, + }: { + textOne: string + textTwo: string + className: string + }) => ( + + {textOne} + {textTwo} + + ) - const RegisterButton = () => ( - - ); + const RegisterButton = () => ( + + ) - return ( - <> -
    -
    -
    - - TEDxSJEC logo - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - TEDxSJEC logo -
    -
    -
    - - - -
    - -
    -
    - TEDxSJEC hero logo -
    -
    -

    - Life - Explore What's Worth Living -

    -
    -
    -
    -
    - - ); -}; + return ( + <> +
    +
    +
    + + TEDxSJEC logo + +
    +
    + +
    +
    +
    +
    +
    + TEDxSJEC logo +
    +
    +
    + + + +
    + +
    +
    + TEDxSJEC hero logo +
    +
    +

    + Life - Explore What's Worth Living +

    +
    +
    +
    +
    + + ) +} -export default Navbar; +export default Navbar \ No newline at end of file