"use client"; import { t } from "@/utils"; import { useSelector } from "react-redux"; import { CurrentLanguageData } from "@/redux/reducer/languageSlice"; import { settingsData } from "@/redux/reducer/settingSlice"; import LanguageDropdown from "../../Common/LanguageDropdown"; import LandingMobileMenu from "@/components/PagesComponent/LandingPage/LandingMobileMenu"; import { useState, useEffect } from "react"; import CustomImage from "@/components/Common/CustomImage"; import CustomLink from "@/components/Common/CustomLink"; const LandingHeader = () => { const CurrentLanguage = useSelector(CurrentLanguageData); const settings = useSelector(settingsData); const [isShowMobileMenu, setIsShowMobileMenu] = useState(false); const [activeSection, setActiveSection] = useState("anythingYouWant"); const handleMobileMenuClose = () => { if (isShowMobileMenu) { setIsShowMobileMenu(false); } }; // Intersection Observer to track which section is currently visible useEffect(() => { const sections = ["anythingYouWant", "work_process", "faq", "ourBlogs"]; const observerOptions = { root: null, rootMargin: "0px", // Trigger when section is 20% from top threshold: 0.7, }; const observerCallback = (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { setActiveSection(entry.target.id); } }); }; const observer = new IntersectionObserver( observerCallback, observerOptions ); // Observe all sections sections.forEach((sectionId) => { const element = document.getElementById(sectionId); if (element) { observer.observe(element); } }); // Cleanup observer on component unmount return () => { observer.disconnect(); }; }, []); return ( <>
); }; export default LandingHeader;