"use client"; import { useState, useEffect } from "react"; import { Button } from "@/components/ui/button"; import { ModeToggle } from "@/components/ui/mode-toggle"; import { X, ArrowRight } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { SignedIn, SignedOut, SignInButton, SignUpButton, UserButton, } from "@clerk/nextjs"; const navLinks = [ { label: "Features", href: "#features" }, { label: "How It Works", href: "#how-it-works" }, { label: "About", href: "#stats" }, { label: "Contact", href: "#footer" }, ]; export function Navbar() { const [isScrolled, setIsScrolled] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [activeLink, setActiveLink] = useState(""); useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 20); }; window.addEventListener("scroll", handleScroll, { passive: true }); return () => window.removeEventListener("scroll", handleScroll); }, []); const handleLinkClick = ( e: React.MouseEvent, href: string, ) => { e.preventDefault(); const targetId = href.replace("#", ""); const element = document.getElementById(targetId); if (element) { element.scrollIntoView({ behavior: "smooth" }); setActiveLink(href); setIsMobileMenuOpen(false); } }; return ( <> {/* Mobile Menu */}
setIsMobileMenuOpen(false)} />
{navLinks.map((link) => ( handleLinkClick(e, link.href)} className="px-4 py-3 text-lg font-medium" > {link.label} ))}
setIsMobileMenuOpen(false)} > setIsMobileMenuOpen(false)} > setIsMobileMenuOpen(false)} className="block" >
Account
); }