diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index c6cc86d..8858418 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,143 +1,114 @@ -import { Link } from "react-router-dom"; -import { useState, useContext } from "react"; +import { NavLink, Link, useLocation } from "react-router-dom"; +import { useState, useContext, useEffect } from "react"; import { ThemeContext } from "../context/ThemeContext"; -import { Moon, Sun } from 'lucide-react'; - +import { Moon, Sun, Menu, X, UserPlus } from 'lucide-react'; const Navbar: React.FC = () => { - const [isOpen, setIsOpen] = useState(false); const themeContext = useContext(ThemeContext); + const { hash } = useLocation(); - if (!themeContext) - return null; + // 1. Bot Fix: Reliable scrolling using URL hash + useEffect(() => { + if (hash === "#features") { + const element = document.getElementById("features"); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + } + }, [hash]); + if (!themeContext) return null; const { toggleTheme, mode } = themeContext; - return ( -