Spaces:
Build error
Build error
File size: 4,088 Bytes
a310a9c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
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>
);
} |