"use client"; import React, { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { usePathname, useRouter } from "next/navigation"; const Header = () => { const [isMenuOpen, setIsMenuOpen] = useState(false); const [isServicesOpen, setIsServicesOpen] = useState(false); const [isMobileServicesOpen, setIsMobileServicesOpen] = useState(false); const pathname = usePathname(); const router = useRouter(); const closeAllMenus = () => { setIsMenuOpen(false); setIsServicesOpen(false); setIsMobileServicesOpen(false); }; const scrollToSection = (sectionId: string) => { closeAllMenus(); // If not on services page, navigate to it first if (pathname !== '/services') { router.push('/services'); // Wait for navigation to complete, then scroll setTimeout(() => { const element = document.getElementById(sectionId); if (element) { element.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }, 100); } else { // Already on services page, just scroll const element = document.getElementById(sectionId); if (element) { element.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } }; const menuItems = [ { href: "/", label: "Home" }, { href: "/about", label: "About" }, { href: "/teamMember", label: "Our Team" }, { href: "/education-training", label: "Academics & Research" }, { href: "/services", label: "Services", hasDropdown: true }, { href: "/events", label: "Events" }, { href: "/blogs", label: "Blogs" }, { href: "/career", label: "Career" }, { href: "/contact", label: "Contact Us" }, ]; return (
{/* Top section with logos */}
{/* Left Logo */}
CMC Logo
{/* Right Logo with Batch ID */}
Batch Logo
H-2024-1431
{/* Bottom section with menu */}
{/* Desktop Navigation */} {/* Mobile menu button */}
{/* Mobile Menu Dropdown */} {isMenuOpen && (
)}
); }; export default Header;