import { useState, useEffect } from "react"; import { Code2, Menu, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { NotchNav } from "./notch-nav"; const NotchNavbar = () => { const [isScrolled, setIsScrolled] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [activeSection, setActiveSection] = useState("home"); useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 20); // Update active section based on scroll position const sections = [ "home", "about", "levels", "workshops", "gallery", "projects", "resources", "team", "join", "contact" ]; const currentSection = sections.find(section => { const element = document.getElementById(section); if (element) { const rect = element.getBoundingClientRect(); return rect.top <= 100 && rect.bottom >= 100; } return false; }); if (currentSection) { setActiveSection(currentSection); } }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); const navItems = [ { value: "home", label: "Home", href: "#home" }, { value: "about", label: "About", href: "#about" }, { value: "levels", label: "Levels", href: "#levels" }, { value: "workshops", label: "Workshops", href: "#workshops" }, { value: "gallery", label: "Gallery", href: "#gallery" }, { value: "projects", label: "Projects", href: "#projects" }, { value: "resources", label: "Resources", href: "#resources" }, { value: "team", label: "Team", href: "#team" }, { value: "join", label: "Join Us", href: "#join" }, { value: "contact", label: "Contact", href: "#contact" }, ]; const scrollToSection = (href: string) => { const element = document.querySelector(href); if (element) { element.scrollIntoView({ behavior: "smooth" }); setIsMobileMenuOpen(false); } }; const handleNavChange = (value: string) => { const item = navItems.find(item => item.value === value); if (item?.href) { scrollToSection(item.href); } setActiveSection(value); }; return ( ); }; export default NotchNavbar;