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

150 lines
6.4 KiB
TypeScript

'use client';
import React, { useState, useEffect } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Menu, X, Smartphone, Layers, Sparkles } 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-4 ${
isScrolled
? 'bg-[#FAF8F5]/90 backdrop-blur-2xl shadow-sm border-b border-slate-900/[0.07]'
: 'bg-[#FAF8F5]/60 backdrop-blur-md border-b border-slate-900/[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-slate-900/[0.03] border border-slate-900/[0.06] backdrop-blur-md shadow-inner shadow-black/[0.01]">
{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-blue-600 bg-white shadow-sm border border-slate-900/[0.06]'
: 'text-slate-600 hover:text-slate-900 hover:bg-slate-900/[0.04]'
}`}
>
{resolveLocalised(item.label, currentLocale)}
</Link>
);
})}
{/* Direct Anchor to Studio Suite */}
<Link
href="/#studio-suite"
className="flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-semibold tracking-wide text-blue-600 hover:text-blue-700 hover:bg-blue-50 transition-colors"
>
<Layers className="w-3.5 h-3.5 text-blue-600" />
<span>Creative Suite</span>
</Link>
</nav>
{/* Right Status & Action Items */}
<div className="hidden lg:flex items-center space-x-4">
{/* 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-white bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 shadow-md shadow-blue-500/20 hover:shadow-lg hover:shadow-blue-500/30 transition-all duration-300 hover:-translate-y-0.5 active:translate-y-0"
>
<Smartphone className="w-4 h-4 text-white 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-700 bg-white border border-slate-200 hover:bg-slate-50 transition-colors shadow-sm"
aria-label="Open menu"
>
{mobileMenuOpen ? <X className="w-5 h-5 text-blue-600" /> : <Menu className="w-5 h-5" />}
</button>
</div>
</div>
{/* Mobile Drawer */}
{mobileMenuOpen && (
<div className="md:hidden mt-3 rounded-2xl border border-slate-200 bg-[#FAF8F5]/98 backdrop-blur-2xl p-5 space-y-3 shadow-xl animate-in slide-in-from-top-4 duration-200">
<div className="flex items-center justify-between pb-3 border-b border-slate-200">
<div className="flex items-center gap-2 text-xs font-mono text-emerald-700">
<span className="h-2 w-2 rounded-full bg-emerald-500 animate-pulse" />
<span>Core v2.4 Active</span>
</div>
<span className="text-[10px] font-mono text-slate-500">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-blue-700 bg-blue-50 border border-blue-200'
: 'text-slate-700 hover:bg-slate-100'
}`}
>
<span>{resolveLocalised(item.label, currentLocale)}</span>
</Link>
);
})}
<Link
href="/#studio-suite"
onClick={() => setMobileMenuOpen(false)}
className="flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold text-blue-700 bg-blue-50/60 hover:bg-blue-100/60"
>
<span className="flex items-center gap-2">
<Layers className="w-4 h-4 text-blue-600" />
Creative Suite
</span>
</Link>
</div>
<div className="pt-3 border-t border-slate-200">
<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-white bg-gradient-to-r from-blue-600 to-indigo-600 shadow-md shadow-blue-500/20"
>
<Smartphone className="w-4 h-4" />
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
</Link>
</div>
</div>
)}
</header>
);
}