Spaces:
Build error
Build error
Upload components/Header.jsx with huggingface_hub
Browse files- components/Header.jsx +113 -0
components/Header.jsx
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
+
import { Menu, X, Github, Linkedin, Twitter, Mail } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
export default function Header() {
|
| 5 |
+
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
| 6 |
+
const [isScrolled, setIsScrolled] = useState(false);
|
| 7 |
+
|
| 8 |
+
useEffect(() => {
|
| 9 |
+
const handleScroll = () => {
|
| 10 |
+
setIsScrolled(window.scrollY > 20);
|
| 11 |
+
};
|
| 12 |
+
window.addEventListener('scroll', handleScroll);
|
| 13 |
+
return () => window.removeEventListener('scroll', handleScroll);
|
| 14 |
+
}, []);
|
| 15 |
+
|
| 16 |
+
const navLinks = [
|
| 17 |
+
{ name: 'About', href: '#about' },
|
| 18 |
+
{ name: 'Skills', href: '#skills' },
|
| 19 |
+
{ name: 'Projects', href: '#projects' },
|
| 20 |
+
{ name: 'Experience', href: '#experience' },
|
| 21 |
+
{ name: 'Contact', href: '#contact' },
|
| 22 |
+
];
|
| 23 |
+
|
| 24 |
+
const socialLinks = [
|
| 25 |
+
{ icon: Github, href: 'https://github.com', label: 'GitHub' },
|
| 26 |
+
{ icon: Linkedin, href: 'https://linkedin.com', label: 'LinkedIn' },
|
| 27 |
+
{ icon: Twitter, href: 'https://twitter.com', label: 'Twitter' },
|
| 28 |
+
{ icon: Mail, href: 'mailto:hello@example.com', label: 'Email' },
|
| 29 |
+
];
|
| 30 |
+
|
| 31 |
+
return (
|
| 32 |
+
<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'}`}>
|
| 33 |
+
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 34 |
+
<div className="flex items-center justify-between h-16">
|
| 35 |
+
{/* Logo */}
|
| 36 |
+
<a href="#" className="text-xl font-bold text-gray-900 hover:text-primary-600 transition-colors">
|
| 37 |
+
Portfolio
|
| 38 |
+
</a>
|
| 39 |
+
|
| 40 |
+
{/* Desktop Navigation */}
|
| 41 |
+
<nav className="hidden md:flex items-center space-x-8">
|
| 42 |
+
{navLinks.map((link) => (
|
| 43 |
+
<a
|
| 44 |
+
key={link.name}
|
| 45 |
+
href={link.href}
|
| 46 |
+
className="text-sm font-medium text-gray-600 hover:text-primary-600 transition-colors"
|
| 47 |
+
>
|
| 48 |
+
{link.name}
|
| 49 |
+
</a>
|
| 50 |
+
))}
|
| 51 |
+
</nav>
|
| 52 |
+
|
| 53 |
+
{/* Social Links - Desktop */}
|
| 54 |
+
<div className="hidden md:flex items-center space-x-4">
|
| 55 |
+
{socialLinks.map((social) => (
|
| 56 |
+
<a
|
| 57 |
+
key={social.label}
|
| 58 |
+
href={social.href}
|
| 59 |
+
target="_blank"
|
| 60 |
+
rel="noopener noreferrer"
|
| 61 |
+
className="text-gray-400 hover:text-primary-600 transition-colors"
|
| 62 |
+
aria-label={social.label}
|
| 63 |
+
>
|
| 64 |
+
<social.icon className="w-5 h-5" />
|
| 65 |
+
</a>
|
| 66 |
+
))}
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
{/* Mobile Menu Button */}
|
| 70 |
+
<button
|
| 71 |
+
onClick={() => setIsMenuOpen(!isMenuOpen)}
|
| 72 |
+
className="md:hidden p-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors"
|
| 73 |
+
aria-label="Toggle menu"
|
| 74 |
+
>
|
| 75 |
+
{isMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
| 76 |
+
</button>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
{/* Mobile Menu */}
|
| 81 |
+
{isMenuOpen && (
|
| 82 |
+
<div className="md:hidden bg-white border-t border-gray-100 animate-fade-in">
|
| 83 |
+
<nav className="px-4 py-4 space-y-2">
|
| 84 |
+
{navLinks.map((link) => (
|
| 85 |
+
<a
|
| 86 |
+
key={link.name}
|
| 87 |
+
href={link.href}
|
| 88 |
+
onClick={() => setIsMenuOpen(false)}
|
| 89 |
+
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"
|
| 90 |
+
>
|
| 91 |
+
{link.name}
|
| 92 |
+
</a>
|
| 93 |
+
))}
|
| 94 |
+
</nav>
|
| 95 |
+
<div className="px-4 pb-4 flex items-center space-x-4">
|
| 96 |
+
{socialLinks.map((social) => (
|
| 97 |
+
<a
|
| 98 |
+
key={social.label}
|
| 99 |
+
href={social.href}
|
| 100 |
+
target="_blank"
|
| 101 |
+
rel="noopener noreferrer"
|
| 102 |
+
className="p-2 text-gray-400 hover:text-primary-600 hover:bg-gray-50 rounded-lg transition-colors"
|
| 103 |
+
aria-label={social.label}
|
| 104 |
+
>
|
| 105 |
+
<social.icon className="w-5 h-5" />
|
| 106 |
+
</a>
|
| 107 |
+
))}
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
)}
|
| 111 |
+
</header>
|
| 112 |
+
);
|
| 113 |
+
}
|