'use client'; import React, { useState, useEffect } from 'react'; import { Layout, Drawer } from 'antd'; import { motion, AnimatePresence } from 'framer-motion'; import { MenuIcon, XIcon, ArrowRightIcon } from 'lucide-react'; import { cn } from '@/utils/cn'; import { Button } from '@/components/ui/Button'; const { Header: AntHeader } = Layout; interface NavigationItem { key: string; label: string; href: string; } const navigationItems: NavigationItem[] = [ { key: 'home', label: 'Home', href: '/' }, { key: 'services', label: 'Services', href: '/services' }, { key: 'components', label: 'Components', href: '/components' }, { key: 'technical-specs', label: 'Technical Specs', href: '/technical-specs' }, { key: 'pricing', label: 'Pricing', href: '/pricing' }, { key: 'docs', label: 'Documentation', href: '/docs' }, { key: 'about', label: 'About', href: '/about' }, ]; export const Header: React.FC = () => { const [isScrolled, setIsScrolled] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [activeKey, setActiveKey] = useState('home'); // Handle scroll effect useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 20); }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); // Handle navigation click const handleNavClick = (href: string, key: string) => { setActiveKey(key); setIsMobileMenuOpen(false); // In a real app, you'd use Next.js router here // router.push(href); }; // Mobile menu animation variants const drawerVariants = { closed: { opacity: 0 }, open: { opacity: 1 }, }; const menuItemVariants = { closed: { x: -20, opacity: 0 }, open: (i: number) => ({ x: 0, opacity: 1, transition: { delay: i * 0.1 }, }), }; return ( <>
{/* Logo */}
C
CHORUS
{/* Desktop Navigation */}
{navigationItems.map((item, index) => ( handleNavClick(item.href, item.key)} className={cn( 'px-4 py-2 rounded-lg font-medium transition-all duration-200', 'hover:bg-white/10 hover:text-chorus-blue', activeKey === item.key ? 'text-chorus-blue' : 'text-gray-300' )} > {item.label} ))}
{/* Desktop CTA Buttons */}
{/* Mobile Menu Button */} setIsMobileMenuOpen(true)} >
{/* Mobile Menu Drawer */} setIsMobileMenuOpen(false)} open={isMobileMenuOpen} width={320} className="mobile-menu-drawer" styles={{ body: { padding: 0, background: '#1a1a1a' }, header: { display: 'none' }, }} > {isMobileMenuOpen && ( {/* Mobile Header */}
C
CHORUS
{/* Mobile Navigation */}
{/* Mobile CTA Buttons */}
)}
{/* Spacer to prevent content from going under fixed header */}
); }; export default Header;