// components/HeaderClient.tsx "use client"; import React, { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { usePathname } from "next/navigation"; // Import usePathname import { FiChevronDown, FiClipboard, FiArrowRight, FiMenu, FiX, FiUsers, FiBriefcase, FiCpu, FiBox, FiFileText, FiUserCheck, } from "react-icons/fi"; import ThemeToggle from "./ThemeToggle"; const omsLogoUrl = "/oms-logo.svg"; type DropdownLinkProps = { href: string; children: React.ReactNode; onClick?: () => void; }; const DropdownLink = ({ href, children, onClick }: DropdownLinkProps) => ( {children} ); const HeaderClient = () => { const [isMenuOpen, setIsMenuOpen] = useState(false); const toggleMenu = () => setIsMenuOpen((open) => !open); const handleMobileLinkClick = () => setIsMenuOpen(false); const [servicesDropdownOpen, setServicesDropdownOpen] = useState(false); const [productsDropdownOpen, setProductsDropdownOpen] = useState(false); const [joinUsDropdownOpen, setJoinUsDropdownOpen] = useState(false); const [offeringsDropdownOpen, setOfferingsDropdownOpen] = useState(false); const handleServicesMouseEnter = () => setServicesDropdownOpen(true); const handleServicesMouseLeave = () => setServicesDropdownOpen(false); const handleProductsMouseEnter = () => setProductsDropdownOpen(true); const handleProductsMouseLeave = () => setProductsDropdownOpen(false); const handleJoinUsMouseEnter = () => setJoinUsDropdownOpen(true); const handleJoinUsMouseLeave = () => setJoinUsDropdownOpen(false); const handleOfferingsMouseEnter = () => setOfferingsDropdownOpen(true); const handleOfferingsMouseLeave = () => setOfferingsDropdownOpen(false); const pathname = usePathname(); // Get current path // Helper function to check if a path is active (exact match for simple links, startsWith for base paths) const isActive = (href: string, exact = false) => { if (exact) { return pathname === href; } // Handle root path specifically if (href === "/") { return pathname === "/"; } return pathname.startsWith(href); }; const megaMenuTriggerClasses = ` relative inline-flex items-center text-sm font-medium text-primary-foreground hover:opacity-90 transition-opacity duration-150 ease-in-out pb-1 after:content-[''] after:absolute after:left-0 after:bottom-0 after:h-[2px] after:w-0 after:bg-primary-foreground/80 after:transition-all after:duration-300 after:ease-out `; const megaMenuItemClasses = ` flex items-center p-3 -m-3 rounded-lg hover:bg-secondary transition-colors duration-150 ease-in-out `; const megaMenuIconClasses = `flex-shrink-0 h-6 w-6 text-primary mr-4`; const megaMenuTextWrapperClasses = `text-sm`; const megaMenuTitleClasses = `font-semibold text-card-foreground`; return ( {/* Top Row */} Owethu Managed Services Home Tech Talk About Us Contact Us Request OBSE Demo {isMenuOpen ? ( ) : ( )} {/* Secondary Row w/ Mega Menus */} {/* Wrap nav and link in a flex container */} {/* Services */} {" "} {/* Apply underline based on active state */} Services Resource Augmentation {/* Add more service links here Project Management */} Product Development {/* Products */} {" "} {/* Apply underline based on active state */} Products {" "} {/* Apply active class */} OBSE Platform {/* Join Our Team */} {" "} {/* Apply underline based on active state */} Join Our Team {" "} {/* Apply active class */} Current Vacancies {" "} {/* Apply active class */} Recruitment Portal Explore Our Offerings Our Offerings {/* ← Here’s the Explore Our Offerings link, back in its original spot Explore Our Offerings */} {" "} {/* Close the new flex container */} {/* Mobile Menu */} Home About Us Services Resource Augmentation Product Development Products OBSE Join Us Vacancies Recruitment Portal Contact Us Explore Our Offerings Our Offerings Request OBSE Demo ); }; export default HeaderClient;
Resource Augmentation
Project Management
Product Development
OBSE Platform
Current Vacancies
Recruitment Portal
Our Offerings