vamcrizer's picture
Upload components/Header.jsx with huggingface_hub
a310a9c verified
import { useState, useEffect } from 'react';
import { Menu, X, Github, Linkedin, Twitter, Mail } from 'lucide-react';
export default function Header() {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const [isScrolled, setIsScrolled] = useState(false);
useEffect(() => {
const handleScroll = () => {
setIsScrolled(window.scrollY > 20);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
const navLinks = [
{ name: 'About', href: '#about' },
{ name: 'Skills', href: '#skills' },
{ name: 'Projects', href: '#projects' },
{ name: 'Experience', href: '#experience' },
{ name: 'Contact', href: '#contact' },
];
const socialLinks = [
{ icon: Github, href: 'https://github.com', label: 'GitHub' },
{ icon: Linkedin, href: 'https://linkedin.com', label: 'LinkedIn' },
{ icon: Twitter, href: 'https://twitter.com', label: 'Twitter' },
{ icon: Mail, href: 'mailto:hello@example.com', label: 'Email' },
];
return (
<header className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${isScrolled ? 'bg-white/95 backdrop-blur-sm shadow-sm' : 'bg-transparent'}`}>
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
{/* Logo */}
<a href="#" className="text-xl font-bold text-gray-900 hover:text-primary-600 transition-colors">
Portfolio
</a>
{/* Desktop Navigation */}
<nav className="hidden md:flex items-center space-x-8">
{navLinks.map((link) => (
<a
key={link.name}
href={link.href}
className="text-sm font-medium text-gray-600 hover:text-primary-600 transition-colors"
>
{link.name}
</a>
))}
</nav>
{/* Social Links - Desktop */}
<div className="hidden md:flex items-center space-x-4">
{socialLinks.map((social) => (
<a
key={social.label}
href={social.href}
target="_blank"
rel="noopener noreferrer"
className="text-gray-400 hover:text-primary-600 transition-colors"
aria-label={social.label}
>
<social.icon className="w-5 h-5" />
</a>
))}
</div>
{/* Mobile Menu Button */}
<button
onClick={() => setIsMenuOpen(!isMenuOpen)}
className="md:hidden p-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors"
aria-label="Toggle menu"
>
{isMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
</button>
</div>
</div>
{/* Mobile Menu */}
{isMenuOpen && (
<div className="md:hidden bg-white border-t border-gray-100 animate-fade-in">
<nav className="px-4 py-4 space-y-2">
{navLinks.map((link) => (
<a
key={link.name}
href={link.href}
onClick={() => setIsMenuOpen(false)}
className="block px-4 py-2 text-base font-medium text-gray-600 hover:text-primary-600 hover:bg-gray-50 rounded-lg transition-colors"
>
{link.name}
</a>
))}
</nav>
<div className="px-4 pb-4 flex items-center space-x-4">
{socialLinks.map((social) => (
<a
key={social.label}
href={social.href}
target="_blank"
rel="noopener noreferrer"
className="p-2 text-gray-400 hover:text-primary-600 hover:bg-gray-50 rounded-lg transition-colors"
aria-label={social.label}
>
<social.icon className="w-5 h-5" />
</a>
))}
</div>
</div>
)}
</header>
);
}