mirror of
https://github.com/OwethuManagedServices/oms-website-nextjs.git
synced 2025-12-17 19:08:09 +00:00
Header updated and achievements added
This commit is contained in:
@ -4,23 +4,25 @@
|
||||
import React, { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
// Use usePathname only if needed for active state logic not shown here
|
||||
// import { usePathname } from "next/navigation";
|
||||
import {
|
||||
FiChevronDown,
|
||||
FiClipboard,
|
||||
FiArrowRight,
|
||||
FiMenu,
|
||||
FiX,
|
||||
FiLogIn, // Import the login icon
|
||||
FiLogIn,
|
||||
FiUsers, // Resource Augmentation
|
||||
FiBriefcase, // Project Management
|
||||
FiCpu, // Product Development
|
||||
FiBox, // OBSE
|
||||
FiFileText, // Vacancies
|
||||
FiUserCheck, // Recruitment Portal
|
||||
} from "react-icons/fi";
|
||||
import ThemeToggle from "./ThemeToggle"; // Assuming ThemeToggle component exists
|
||||
import type { Session } from "@auth/core/types"; // Import Session type for props
|
||||
import ThemeToggle from "./ThemeToggle";
|
||||
import type { Session } from "@auth/core/types";
|
||||
|
||||
const omsLogoUrl = "/oms-logo.svg"; // Ensure this is in your /public folder
|
||||
const omsLogoUrl = "/oms-logo.svg";
|
||||
|
||||
// --- Basic Dropdown Component ---
|
||||
// (Keep the DropdownMenu and DropdownLink component definitions here as before)
|
||||
type DropdownMenuProps = {
|
||||
trigger: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
@ -31,7 +33,6 @@ const DropdownMenu = ({
|
||||
children,
|
||||
menuClasses = "w-48",
|
||||
}: DropdownMenuProps) => (
|
||||
// Using group-focus-within for better keyboard/touch accessibility
|
||||
<div className="relative group">
|
||||
<button className="flex items-center space-x-1 text-sm font-medium focus:outline-none inherit-color group">
|
||||
{trigger}
|
||||
@ -40,8 +41,9 @@ const DropdownMenu = ({
|
||||
<div
|
||||
className={`
|
||||
absolute left-0 mt-2 ${menuClasses} origin-top-left rounded-md shadow-lg z-50
|
||||
bg-card border border-border {/* USE SEMANTIC VARS */}
|
||||
opacity-0 invisible group-hover:opacity-100 group-hover:visible group-focus-within:opacity-100 group-focus-within:visible transition-all duration-200
|
||||
bg-card border border-border
|
||||
opacity-0 invisible group-hover:opacity-100 group-hover:visible group-focus-within:opacity-100 group-focus-within:visible
|
||||
transition-all duration-200
|
||||
`}
|
||||
>
|
||||
<div className="py-1">{children}</div>
|
||||
@ -52,101 +54,100 @@ const DropdownMenu = ({
|
||||
type DropdownLinkProps = {
|
||||
href: string;
|
||||
children: React.ReactNode;
|
||||
onClick?: () => void; // Added onClick for mobile menu closure
|
||||
onClick?: () => void;
|
||||
};
|
||||
const DropdownLink = ({ href, children, onClick }: DropdownLinkProps) => (
|
||||
<Link
|
||||
href={href}
|
||||
onClick={onClick} // Call onClick if provided
|
||||
className="block w-full text-left px-4 py-2 text-sm text-card-foreground hover:bg-secondary hover:text-primary" // USE SEMANTIC VARS
|
||||
onClick={onClick}
|
||||
className="block w-full text-left px-4 py-2 text-sm text-card-foreground hover:bg-secondary hover:text-primary transition-colors duration-150"
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
// --- End Dropdown Component ---
|
||||
|
||||
// --- Define Props for the Client Component ---
|
||||
type HeaderClientProps = {
|
||||
session: Session | null; // Accept session from the server component
|
||||
handleSignIn: () => void; // Pass sign-in handler
|
||||
handleSignOut: () => void; // Pass sign-out handler
|
||||
session: Session | null;
|
||||
handleSignIn: () => void;
|
||||
handleSignOut: () => void;
|
||||
};
|
||||
|
||||
// --- The Main Client Component ---
|
||||
const HeaderClient = ({
|
||||
session,
|
||||
handleSignIn,
|
||||
handleSignOut,
|
||||
}: HeaderClientProps) => {
|
||||
// --- Client-side state and hooks ---
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
// const pathname = usePathname() || "/"; // Uncomment if needed
|
||||
// const isActive = (path: string) => pathname === path; // Uncomment if needed
|
||||
|
||||
const toggleMenu = () => setIsMenuOpen((open) => !open);
|
||||
const handleMobileLinkClick = () => setIsMenuOpen(false);
|
||||
|
||||
const currentLogo = omsLogoUrl;
|
||||
const megaMenuTriggerClasses = `
|
||||
relative inline-flex items-center text-sm font-medium text-primary-foreground group
|
||||
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
|
||||
group-hover:after:w-full group-focus-within:after:w-full
|
||||
`;
|
||||
|
||||
const megaMenuItemClasses = `
|
||||
flex items-center p-3 -m-3 rounded-lg
|
||||
hover:bg-secondary transition-colors duration-150 ease-in-out group
|
||||
`;
|
||||
const megaMenuIconClasses = `flex-shrink-0 h-6 w-6 text-primary group-hover:text-primary-focus mr-4`;
|
||||
const megaMenuTextWrapperClasses = `text-sm`;
|
||||
const megaMenuTitleClasses = `font-semibold text-card-foreground`;
|
||||
|
||||
return (
|
||||
// Use semantic variables for header background and border
|
||||
<header className="sticky top-0 z-50 shadow-md bg-background border-b border-border">
|
||||
{/* Top Row */}
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex justify-between items-center h-16">
|
||||
{/* Logo */}
|
||||
<Link
|
||||
href="/"
|
||||
className="flex items-center space-x-2"
|
||||
title="OMS Home"
|
||||
>
|
||||
<Image
|
||||
src={currentLogo}
|
||||
src={omsLogoUrl}
|
||||
alt="OMS Logo"
|
||||
width={40}
|
||||
height={40}
|
||||
priority
|
||||
/>
|
||||
{/* Use semantic variable for text color */}
|
||||
<span className="text-xl font-bold text-foreground hidden sm:inline">
|
||||
Owethu Managed Services
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
{/* Desktop Navigation */}
|
||||
<nav className="hidden md:flex items-center space-x-6 lg:space-x-8">
|
||||
{/* Use semantic variables for text, hover uses primary */}
|
||||
<Link
|
||||
href="/"
|
||||
className={`text-sm font-medium text-foreground/80 hover:text-primary transition`}
|
||||
className="text-sm font-medium text-foreground/80 hover:text-primary transition"
|
||||
>
|
||||
Home
|
||||
</Link>
|
||||
<Link
|
||||
href="/tech-talk"
|
||||
className={`text-sm font-medium text-foreground/80 hover:text-primary transition`}
|
||||
className="text-sm font-medium text-foreground/80 hover:text-primary transition"
|
||||
>
|
||||
Tech Talk
|
||||
</Link>
|
||||
<Link
|
||||
href="/about"
|
||||
className={`text-sm font-medium text-foreground/80 hover:text-primary transition`}
|
||||
className="text-sm font-medium text-foreground/80 hover:text-primary transition"
|
||||
>
|
||||
About Us
|
||||
</Link>
|
||||
<Link
|
||||
href="/contact"
|
||||
className={`text-sm font-medium text-foreground/80 hover:text-primary transition`}
|
||||
className="text-sm font-medium text-foreground/80 hover:text-primary transition"
|
||||
>
|
||||
Contact Us
|
||||
</Link>
|
||||
</nav>
|
||||
|
||||
{/* Desktop Utilities */}
|
||||
<div className="hidden md:flex items-center space-x-4">
|
||||
<ThemeToggle />
|
||||
|
||||
{/* Request Demo Button */}
|
||||
<Link
|
||||
href="/request-demo"
|
||||
className="flex items-center text-sm font-medium bg-primary text-primary-foreground px-3 py-1.5 rounded-lg hover:bg-opacity-90 transition-colors"
|
||||
@ -156,39 +157,34 @@ const HeaderClient = ({
|
||||
Request OBSE Demo
|
||||
</Link>
|
||||
|
||||
{/* --- Auth Section --- */}
|
||||
{session?.user ? (
|
||||
// Logged In: User Dropdown
|
||||
<DropdownMenu
|
||||
menuClasses="w-40 right-0 left-auto" // Align dropdown to the right
|
||||
menuClasses="w-40 right-0 left-auto"
|
||||
trigger={
|
||||
<div className="flex items-center space-x-2 cursor-pointer hover:opacity-80 transition">
|
||||
<Image
|
||||
src={session.user.image || "/default-avatar.png"} // Provide a fallback avatar
|
||||
src={session.user.image || "/default-avatar.png"}
|
||||
alt={session.user.name || "User"}
|
||||
width={32}
|
||||
height={32}
|
||||
className="rounded-full ring-1 ring-primary ring-offset-2 ring-offset-background" // Added offset
|
||||
className="rounded-full ring-1 ring-primary ring-offset-2 ring-offset-background"
|
||||
/>
|
||||
{/* Optionally hide name on smaller desktop screens */}
|
||||
<span className="text-sm font-medium text-foreground hidden lg:inline">
|
||||
{session.user.name?.split(" ")[0]}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{/* Sign Out inside the dropdown */}
|
||||
<button
|
||||
onClick={() => handleSignOut()}
|
||||
className="block w-full text-left px-4 py-2 text-sm text-destructive hover:bg-secondary hover:text-destructive transition" // Destructive color
|
||||
onClick={handleSignOut}
|
||||
className="block w-full text-left px-4 py-2 text-sm text-destructive hover:bg-secondary hover:text-destructive transition"
|
||||
>
|
||||
Sign Out
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
// Logged Out: Icon Button to Sign In
|
||||
<button
|
||||
onClick={() => handleSignIn()}
|
||||
onClick={handleSignIn}
|
||||
className="p-2 rounded-full text-foreground/70 hover:text-primary hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background transition-colors"
|
||||
title="Sign In"
|
||||
aria-label="Sign In"
|
||||
@ -196,15 +192,13 @@ const HeaderClient = ({
|
||||
<FiLogIn className="w-5 h-5" />
|
||||
</button>
|
||||
)}
|
||||
{/* --- End Auth Section --- */}
|
||||
</div>
|
||||
|
||||
{/* Mobile Buttons */}
|
||||
<div className="md:hidden flex items-center">
|
||||
<ThemeToggle /> {/* Theme toggle remains */}
|
||||
<ThemeToggle />
|
||||
<button
|
||||
onClick={toggleMenu}
|
||||
className="text-foreground/60 hover:text-primary focus:outline-none ml-3" // Use semantic muted color, hover primary
|
||||
className="text-foreground/60 hover:text-primary focus:outline-none ml-3"
|
||||
aria-label="Toggle menu"
|
||||
aria-expanded={isMenuOpen}
|
||||
aria-controls="mobile-menu"
|
||||
@ -219,39 +213,144 @@ const HeaderClient = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Secondary Row (Desktop Only) */}
|
||||
<div className="bg-primary">
|
||||
{/* Secondary Row w/ Mega Menus */}
|
||||
<div className="bg-primary relative">
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div className="hidden md:flex justify-between items-center h-12">
|
||||
<nav className="flex items-center space-x-6 lg:space-x-8 text-primary-foreground">
|
||||
<div className="hover:text-opacity-80 transition-opacity">
|
||||
<DropdownMenu trigger={<span>Services</span>}>
|
||||
<DropdownLink href="/services/resource-augmentation">
|
||||
Resource Augmentation
|
||||
</DropdownLink>
|
||||
<DropdownLink href="/services/project-management">
|
||||
Project Management
|
||||
</DropdownLink>
|
||||
<DropdownLink href="/services/product-development">
|
||||
Product Development
|
||||
</DropdownLink>
|
||||
</DropdownMenu>
|
||||
<nav className="flex items-center space-x-8 lg:space-x-10">
|
||||
{/* Services */}
|
||||
<div className="group">
|
||||
<button className={megaMenuTriggerClasses}>
|
||||
Services
|
||||
<FiChevronDown className="w-4 h-4 ml-1.5 opacity-70 group-hover:rotate-180 transition-transform duration-200" />
|
||||
</button>
|
||||
<div
|
||||
className={`
|
||||
absolute left-0 top-full w-full shadow-lg z-40
|
||||
bg-card border-x border-b border-border rounded-b-lg
|
||||
opacity-0 invisible translate-y-[-10px]
|
||||
group-hover:opacity-100 group-hover:visible group-hover:translate-y-0
|
||||
transition-all duration-300 ease-out transform
|
||||
`}
|
||||
>
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 py-5">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-x-8 gap-y-6">
|
||||
<Link
|
||||
href="/services/resource-augmentation"
|
||||
className={megaMenuItemClasses}
|
||||
>
|
||||
<FiUsers className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>
|
||||
Resource Augmentation
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
href="/services/project-management"
|
||||
className={megaMenuItemClasses}
|
||||
>
|
||||
<FiBriefcase className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>
|
||||
Project Management
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
href="/services/product-development"
|
||||
className={megaMenuItemClasses}
|
||||
>
|
||||
<FiCpu className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>
|
||||
Product Development
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="mt-6 pt-4 border-t border-border flex justify-end">
|
||||
<Link
|
||||
href="/services"
|
||||
className="flex items-center text-sm font-medium text-primary hover:underline"
|
||||
>
|
||||
Explore All Services
|
||||
<FiArrowRight className="w-4 h-4 ml-1" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="hover:text-opacity-80 transition-opacity">
|
||||
<DropdownMenu trigger={<span>Products</span>}>
|
||||
<DropdownLink href="/obse">OBSE</DropdownLink>
|
||||
</DropdownMenu>
|
||||
{/* Products */}
|
||||
<div className="group">
|
||||
<button className={megaMenuTriggerClasses}>
|
||||
Products
|
||||
<FiChevronDown className="w-4 h-4 ml-1.5 opacity-70 group-hover:rotate-180 transition-transform duration-200" />
|
||||
</button>
|
||||
<div
|
||||
className={`
|
||||
absolute left-0 top-full w-full shadow-lg z-40
|
||||
bg-card border-x border-b border-border rounded-b-lg
|
||||
opacity-0 invisible translate-y-[-10px]
|
||||
group-hover:opacity-100 group-hover:visible group-hover:translate-y-0
|
||||
transition-all duration-300 ease-out transform
|
||||
`}
|
||||
>
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 py-5">
|
||||
<div className="max-w-md">
|
||||
<Link href="/obse" className={megaMenuItemClasses}>
|
||||
<FiBox className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>OBSE Platform</p>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="hover:text-opacity-80 transition-opacity">
|
||||
<DropdownMenu trigger={<span>Join Our Team</span>}>
|
||||
<DropdownLink href="/vacancies">Vacancies</DropdownLink>
|
||||
<DropdownLink href="/portal">Recruitment Portal</DropdownLink>
|
||||
</DropdownMenu>
|
||||
{/* Join Our Team */}
|
||||
<div className="group">
|
||||
<button className={megaMenuTriggerClasses}>
|
||||
Join Our Team
|
||||
<FiChevronDown className="w-4 h-4 ml-1.5 opacity-70 group-hover:rotate-180 transition-transform duration-200" />
|
||||
</button>
|
||||
<div
|
||||
className={`
|
||||
absolute left-0 top-full w-full shadow-lg z-40
|
||||
bg-card border-x border-b border-border rounded-b-lg
|
||||
opacity-0 invisible translate-y-[-10px]
|
||||
group-hover:opacity-100 group-hover:visible group-hover:translate-y-0
|
||||
transition-all duration-300 ease-out transform
|
||||
`}
|
||||
>
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 py-5">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 max-w-xl">
|
||||
<Link href="/vacancies" className={megaMenuItemClasses}>
|
||||
<FiFileText className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>
|
||||
Current Vacancies
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href="/portal" className={megaMenuItemClasses}>
|
||||
<FiUserCheck className={megaMenuIconClasses} />
|
||||
<div className={megaMenuTextWrapperClasses}>
|
||||
<p className={megaMenuTitleClasses}>
|
||||
Recruitment Portal
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{/* ← Here’s the Explore Our Offerings link, back in its original spot */}
|
||||
<Link
|
||||
href="/services"
|
||||
className="flex items-center text-sm font-medium text-primary-foreground hover:text-opacity-80 transition-opacity group"
|
||||
className="flex items-center text-sm font-medium text-primary-foreground hover:opacity-80 transition-opacity group"
|
||||
>
|
||||
Explore Our Offerings
|
||||
<FiArrowRight className="w-4 h-4 ml-1.5 transition-transform duration-200 group-hover:translate-x-1" />
|
||||
@ -260,21 +359,16 @@ const HeaderClient = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Mobile Menu Panel */}
|
||||
{/* Mobile Menu */}
|
||||
<div
|
||||
id="mobile-menu"
|
||||
// Use semantic variables for background and border
|
||||
className={`md:hidden absolute top-full left-0 w-full shadow-lg transition-all duration-300 ease-in-out overflow-hidden bg-card border-t border-border ${
|
||||
isMenuOpen
|
||||
? "max-h-[calc(100vh-4rem)] py-4 overflow-y-auto"
|
||||
: "max-h-0 py-0" // Animate height, allow scroll
|
||||
: "max-h-0 py-0"
|
||||
}`}
|
||||
>
|
||||
{/* Use semantic variable for text color */}
|
||||
<nav className="container mx-auto px-4 sm:px-6 lg:px-8 flex flex-col space-y-1 text-foreground">
|
||||
{" "}
|
||||
{/* Reduced space-y */}
|
||||
{/* Mobile Links */}
|
||||
<DropdownLink href="/" onClick={handleMobileLinkClick}>
|
||||
Home
|
||||
</DropdownLink>
|
||||
@ -305,41 +399,33 @@ const HeaderClient = ({
|
||||
<span className="pt-3 pb-1 text-xs uppercase text-muted-foreground">
|
||||
Products
|
||||
</span>
|
||||
<DropdownLink href="/products/obse" onClick={handleMobileLinkClick}>
|
||||
<DropdownLink href="/obse" onClick={handleMobileLinkClick}>
|
||||
OBSE
|
||||
</DropdownLink>
|
||||
<span className="pt-3 pb-1 text-xs uppercase text-muted-foreground">
|
||||
Join Us
|
||||
</span>
|
||||
<DropdownLink
|
||||
href="/join-us/vacancies"
|
||||
onClick={handleMobileLinkClick}
|
||||
>
|
||||
<DropdownLink href="/vacancies" onClick={handleMobileLinkClick}>
|
||||
Vacancies
|
||||
</DropdownLink>
|
||||
<DropdownLink href="/join-us/portal" onClick={handleMobileLinkClick}>
|
||||
<DropdownLink href="/portal" onClick={handleMobileLinkClick}>
|
||||
Recruitment Portal
|
||||
</DropdownLink>
|
||||
<DropdownLink href="/contact" onClick={handleMobileLinkClick}>
|
||||
Contact Us
|
||||
</DropdownLink>
|
||||
{/* Demo Button */}
|
||||
<div className="pt-4">
|
||||
<Link
|
||||
href="/request-demo"
|
||||
onClick={handleMobileLinkClick}
|
||||
// Use semantic variables for button style
|
||||
className="flex w-full justify-center items-center text-sm font-medium bg-primary text-primary-foreground px-4 py-2 rounded-lg hover:bg-opacity-90 transition-colors"
|
||||
title="Request a Demo"
|
||||
>
|
||||
<FiClipboard className="w-4 h-4 mr-1.5" />
|
||||
Request OBSE Demo
|
||||
<FiClipboard className="w-4 h-4 mr-1.5" /> Request OBSE Demo
|
||||
</Link>
|
||||
</div>
|
||||
{/* Auth Buttons in Mobile Menu */}
|
||||
<div className="pt-4 border-t border-border mt-4">
|
||||
{session?.user ? (
|
||||
// Sign Out Button (Text)
|
||||
<button
|
||||
onClick={() => {
|
||||
handleSignOut();
|
||||
@ -350,7 +436,6 @@ const HeaderClient = ({
|
||||
Sign Out
|
||||
</button>
|
||||
) : (
|
||||
// Sign In Button (Text or Icon+Text)
|
||||
<button
|
||||
onClick={() => {
|
||||
handleSignIn();
|
||||
@ -358,8 +443,7 @@ const HeaderClient = ({
|
||||
}}
|
||||
className="flex items-center w-full text-left px-4 py-2 text-sm font-medium text-foreground hover:bg-secondary hover:text-primary transition"
|
||||
>
|
||||
<FiLogIn className="w-4 h-4 mr-2" /> {/* Added icon here too */}
|
||||
Sign In
|
||||
<FiLogIn className="w-4 h-4 mr-2" /> Sign In
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user