'use client' import { useState, useEffect } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Menu, X, Lock, Shield } from 'lucide-react' import Link from 'next/link' import { usePathname } from 'next/navigation' export default function Header() { const [isScrolled, setIsScrolled] = useState(false) const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false) const pathname = usePathname() const isHomePage = pathname === '/' useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 20) } window.addEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll) }, []) const navItems = [ { href: '#accueil', label: 'Accueil' }, { href: '#services', label: 'Services' }, { href: '#tarifs', label: 'Tarifs' }, { href: '#faq', label: 'FAQ' }, { href: '#contact', label: 'Contact' }, ] const getNavHref = (href: string) => { if (isHomePage) { return href } return `/${href}` } return ( {/* Mobile Menu */} {isMobileMenuOpen && (
{navItems.map((item) => ( setIsMobileMenuOpen(false)} className="block text-gray-300 hover:text-security-accent font-medium transition-colors py-2" > {item.label} ))} setIsMobileMenuOpen(false)} className="block w-full text-center px-6 py-3 bg-gradient-to-r from-security-accent to-green-500 text-black rounded-xl font-semibold mt-4" > Demander un devis
)}
) }