Files
webb/src/components/ui/Navbar.tsx
T

159 lines
7.0 KiB
TypeScript
Raw Normal View History

'use client';
import React, { useState, useEffect } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Menu, X, Smartphone, Layers, Sparkles, Activity } from 'lucide-react';
import { SiteConfig, resolveLocalised } from '@/types';
import { BrandLogo } from './BrandLogo';
interface NavbarProps {
config: SiteConfig;
currentLocale: string;
}
export function Navbar({ config, currentLocale }: NavbarProps) {
const [isScrolled, setIsScrolled] = useState(false);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const pathname = usePathname();
useEffect(() => {
const handleScroll = () => {
setIsScrolled(window.scrollY > 20);
};
window.addEventListener('scroll', handleScroll, { passive: true });
return () => window.removeEventListener('scroll', handleScroll);
}, []);
return (
<header
className={`sticky top-0 z-50 transition-all duration-300 px-4 sm:px-6 lg:px-8 py-3.5 ${
isScrolled
? 'bg-[#05070B]/85 backdrop-blur-2xl shadow-2xl shadow-cyan-950/20 border-b border-white/[0.08]'
: 'bg-transparent border-b border-white/[0.04]'
}`}
>
<div className="max-w-7xl mx-auto flex items-center justify-between">
{/* Bespoke CRE Innovations Vector Brand Logo */}
<BrandLogo size="md" />
{/* Center Navigation Links (Floating Glass Pill on Desktop) */}
<nav className="hidden md:flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/[0.03] border border-white/[0.08] backdrop-blur-xl shadow-inner shadow-white/[0.02]">
{config.nav.header.map((item) => {
const active = pathname === item.href;
return (
<Link
key={item.href}
href={item.href}
className={`relative px-4 py-2 rounded-full text-xs font-semibold tracking-wide transition-all duration-200 ${
active
? 'text-cyan-300 bg-white/[0.08] shadow-[0_0_15px_rgba(0,240,255,0.2)] border border-cyan-500/30'
: 'text-slate-300 hover:text-white hover:bg-white/[0.04]'
}`}
>
{resolveLocalised(item.label, currentLocale)}
</Link>
);
})}
{/* Direct Anchor to Vertical Tool Stack */}
<Link
href="/#tools-stack"
className="flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-semibold tracking-wide text-cyan-400 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors"
>
<Layers className="w-3.5 h-3.5 text-cyan-400" />
<span>Tools Stack</span>
</Link>
</nav>
{/* Right Status & Action Items */}
<div className="hidden lg:flex items-center space-x-4">
{/* Live System Operational Indicator */}
<div className="flex items-center gap-2 px-3 py-1.5 rounded-full bg-emerald-950/40 border border-emerald-500/30 text-[11px] font-mono text-emerald-400 shadow-sm">
<span className="relative flex h-2 w-2">
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
<span className="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
</span>
<span>Neural Core v2.4 Active</span>
</div>
{/* Primary CTA Button */}
<Link
href={config.nav.cta.href}
className="group relative inline-flex items-center gap-2 px-5 py-2.5 rounded-full text-xs font-bold text-black bg-gradient-to-r from-cyan-400 via-teal-300 to-cyan-300 hover:from-cyan-300 hover:to-teal-200 shadow-[0_0_25px_rgba(0,240,255,0.35)] hover:shadow-[0_0_35px_rgba(0,240,255,0.5)] transition-all duration-300 hover:-translate-y-0.5 active:translate-y-0"
>
<Smartphone className="w-4 h-4 text-black group-hover:rotate-6 transition-transform" />
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
</Link>
</div>
{/* Mobile menu trigger */}
<div className="flex md:hidden items-center space-x-2">
<button
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
className="p-2.5 rounded-xl text-slate-200 bg-white/[0.05] border border-white/[0.1] hover:bg-white/[0.1] transition-colors"
aria-label="Open menu"
>
{mobileMenuOpen ? <X className="w-5 h-5 text-cyan-400" /> : <Menu className="w-5 h-5" />}
</button>
</div>
</div>
{/* Mobile Drawer */}
{mobileMenuOpen && (
<div className="md:hidden mt-3 rounded-2xl border border-white/[0.1] bg-[#07090E]/95 backdrop-blur-2xl p-5 space-y-3 shadow-2xl animate-in slide-in-from-top-4 duration-200">
<div className="flex items-center justify-between pb-3 border-b border-white/[0.08]">
<div className="flex items-center gap-2 text-xs font-mono text-emerald-400">
<span className="h-2 w-2 rounded-full bg-emerald-400 animate-pulse" />
<span>Core v2.4 Active</span>
</div>
<span className="text-[10px] font-mono text-slate-400">RAM Streaming</span>
</div>
<div className="space-y-1">
{config.nav.header.map((item) => {
const active = pathname === item.href;
return (
<Link
key={item.href}
href={item.href}
onClick={() => setMobileMenuOpen(false)}
className={`flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold transition-colors ${
active
? 'text-cyan-400 bg-cyan-950/40 border border-cyan-500/30'
: 'text-slate-300 hover:bg-white/[0.05]'
}`}
>
<span>{resolveLocalised(item.label, currentLocale)}</span>
</Link>
);
})}
<Link
href="/#tools-stack"
onClick={() => setMobileMenuOpen(false)}
className="flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold text-cyan-400 bg-white/[0.03] hover:bg-white/[0.06]"
>
<span className="flex items-center gap-2">
<Layers className="w-4 h-4 text-cyan-400" />
Tools Stack
</span>
</Link>
</div>
<div className="pt-3 border-t border-white/[0.08]">
<Link
href={config.nav.cta.href}
onClick={() => setMobileMenuOpen(false)}
className="flex items-center justify-center gap-2 w-full py-3.5 rounded-xl text-sm font-bold text-black bg-gradient-to-r from-cyan-400 to-teal-300 shadow-[0_0_20px_rgba(0,240,255,0.3)]"
>
<Smartphone className="w-4 h-4" />
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
</Link>
</div>
</div>
)}
</header>
);
}