From b9538f88559a29c6e60665267808a812fa5d2c32 Mon Sep 17 00:00:00 2001 From: Marc Wieland Date: Wed, 30 Apr 2025 00:17:22 +0200 Subject: [PATCH] Dynamic Navbar --- src/pages/Index.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index a39807503..cb7d06ed0 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -1,21 +1,39 @@ +import { useEffect } from "react"; +import { useLocation } from "react-router-dom"; -import Navbar from "@/components/Navbar"; import Hero from "@/components/Hero"; import NewsSection from "@/components/NewsSection"; import TeamSection from "@/components/TeamSection"; import GallerySection from "@/components/GallerySection"; import AboutSection from "@/components/AboutSection"; import ContactSection from "@/components/ContactSection"; -import Footer from "@/components/Footer"; const Index = () => { + const location = useLocation(); + + useEffect(() => { + const scrollToId = location.state?.scrollTo; + if (scrollToId) { + const element = document.getElementById(scrollToId); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + } + }, [location]); + return (
+
+
+
+