'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 Link from 'next/link';
import { usePathname } from 'next/navigation';
import { cn } from '@/utils/cn';
import { Button } from '@/components/ui/Button';
import { Typography } from '@/components/ui/Typography';
const { Header: AntHeader } = Layout;
interface NavigationItem {
key: string;
label: string;
href: string;
}
const navigationItems: NavigationItem[] = [
{ key: 'home', label: 'Home', href: '/' },
{ key: 'technical-specs', label: 'Technical Specs', href: '/technical-specs' },
];
export const Header: React.FC = () => {
const [isScrolled, setIsScrolled] = useState(false);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const pathname = usePathname();
// Handle scroll effect
useEffect(() => {
const handleScroll = () => {
setIsScrolled(window.scrollY > 20);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
// Handle mobile menu close
const handleMobileMenuClose = () => {
setIsMobileMenuOpen(false);
};
// Get active key based on current pathname
const getActiveKey = () => {
const item = navigationItems.find(item => item.href === pathname);
return item?.key || 'home';
};
// 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 (
<>