From fc151dee4fb4e47aeec1e9588d09b0cd3284b7fd Mon Sep 17 00:00:00 2001 From: shivanshiv Date: Sat, 22 Nov 2025 22:30:18 -0700 Subject: [PATCH] Add top nav dropdown with auto-scroll to page sections (Closes #528) --- src/App.tsx | 25 ++++++++- src/components/Navbar.css | 27 +++++++++ src/components/Navbar.tsx | 111 ++++++++++++++++++++++++++++++++++--- src/pages/ApplyPage.tsx | 6 +- src/pages/HomePage.tsx | 8 ++- src/pages/ProjectsPage.tsx | 5 +- src/pages/TeamPage.tsx | 4 +- 7 files changed, 166 insertions(+), 20 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1b8f2c4e..cd8314fe 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,8 +6,8 @@ import TeamPage from "pages/TeamPage"; import ProjectsPage from "pages/ProjectsPage"; import MerchPage from "pages/MerchPage"; -import { useEffect } from "react"; -import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; +import React, { useEffect } from "react"; +import { BrowserRouter as Router, Route, Switch, useLocation } from "react-router-dom"; import Navbar from "components/Navbar"; import Footer from "components/Footer/Footer"; import "./App.css"; @@ -16,6 +16,26 @@ import "aos/dist/aos.css"; import ScrollToTop from "components/ScrollToTop"; import GalleryPage from "pages/GalleryPage"; +function ScrollToHash() { + const location = useLocation(); + + useEffect(() => { + if (location.hash) { + setTimeout(() => { + const id = location.hash.replace('#', ''); + const element = document.getElementById(id); + if (element) { + const yOffset = -80; + const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset; + window.scrollTo({ top: y, behavior: 'smooth' }); + } + }, 100); + } + }, [location]); + + return null; +} + function App() { // useEffect(() => { @@ -24,6 +44,7 @@ function App() { // Use React Router to switch between different pages return ( +
diff --git a/src/components/Navbar.css b/src/components/Navbar.css index 85c9d716..f5b549dc 100644 --- a/src/components/Navbar.css +++ b/src/components/Navbar.css @@ -166,3 +166,30 @@ opacity: 0; display: none; } + +/* Navigation sections with subsections */ +.navbar__section { + display: block; +} + +.navbar__subsections { + display: flex; + flex-direction: column; + list-style: none; + padding: 5px 0 0 40px; + margin: 0; +} + +.navbar__subsections li { + margin: 3px 0; +} + +.navbar__subsections a { + font-size: 0.85rem; + color: #ccc; + transition: color 0.3s ease; +} + +.navbar__subsections a:hover { + color: var(--primary-green); +} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 4cb6dbf5..38a2166e 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -60,14 +60,109 @@ const Header = () => {
-
+
{ Tech Start Members
-
+
@@ -227,7 +227,7 @@ const ApplyPage = () => { />
-
+
{
- +
+ +
-
+
{
-
+
{

Final Showcase Winners

@@ -120,13 +121,13 @@ const ProjectsPage = () => {
-

+

-

+

Past Projects

diff --git a/src/pages/TeamPage.tsx b/src/pages/TeamPage.tsx index 52d90f18..4079cd5e 100644 --- a/src/pages/TeamPage.tsx +++ b/src/pages/TeamPage.tsx @@ -61,12 +61,12 @@ const TeamPage = () => { -

+

The Board

- +