Spaces:
Running
Running
Upload components/Header.tsx with huggingface_hub
Browse files- components/Header.tsx +96 -0
components/Header.tsx
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react'
|
| 2 |
+
import { Menu, X } from 'lucide-react'
|
| 3 |
+
|
| 4 |
+
const Header = () => {
|
| 5 |
+
const [isScrolled, setIsScrolled] = useState(false)
|
| 6 |
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
|
| 7 |
+
|
| 8 |
+
useEffect(() => {
|
| 9 |
+
const handleScroll = () => {
|
| 10 |
+
setIsScrolled(window.scrollY > 50)
|
| 11 |
+
}
|
| 12 |
+
window.addEventListener('scroll', handleScroll)
|
| 13 |
+
return () => window.removeEventListener('scroll', handleScroll)
|
| 14 |
+
}, [])
|
| 15 |
+
|
| 16 |
+
const navLinks = [
|
| 17 |
+
{ href: '#about', label: 'About' },
|
| 18 |
+
{ href: '#projects', label: 'Projects' },
|
| 19 |
+
{ href: '#services', label: 'Services' },
|
| 20 |
+
{ href: '#contact', label: 'Contact' },
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
return (
|
| 24 |
+
<header
|
| 25 |
+
className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${
|
| 26 |
+
isScrolled ? 'bg-margins-black/90 backdrop-blur-md py-4' : 'bg-transparent py-6'
|
| 27 |
+
}`}
|
| 28 |
+
>
|
| 29 |
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 30 |
+
<div className="flex items-center justify-between">
|
| 31 |
+
<a href="#" className="text-2xl font-light tracking-wider uppercase">
|
| 32 |
+
Margins
|
| 33 |
+
</a>
|
| 34 |
+
|
| 35 |
+
{/* Desktop Navigation */}
|
| 36 |
+
<nav className="hidden md:flex items-center space-x-8">
|
| 37 |
+
{navLinks.map((link) => (
|
| 38 |
+
<a
|
| 39 |
+
key={link.href}
|
| 40 |
+
href={link.href}
|
| 41 |
+
className="text-sm uppercase tracking-widest text-margins-gray hover:text-white transition-colors duration-300"
|
| 42 |
+
>
|
| 43 |
+
{link.label}
|
| 44 |
+
</a>
|
| 45 |
+
))}
|
| 46 |
+
<a
|
| 47 |
+
href="https://huggingface.co/spaces/akhaliq/anycoder"
|
| 48 |
+
target="_blank"
|
| 49 |
+
rel="noopener noreferrer"
|
| 50 |
+
className="text-xs uppercase tracking-widest text-margins-gray hover:text-white transition-colors duration-300 border-l border-margins-gray pl-8"
|
| 51 |
+
>
|
| 52 |
+
Built with anycoder
|
| 53 |
+
</a>
|
| 54 |
+
</nav>
|
| 55 |
+
|
| 56 |
+
{/* Mobile Menu Button */}
|
| 57 |
+
<button
|
| 58 |
+
className="md:hidden text-white p-2"
|
| 59 |
+
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
|
| 60 |
+
aria-label="Toggle menu"
|
| 61 |
+
>
|
| 62 |
+
{isMobileMenuOpen ? <X size={24} /> : <Menu size={24} />}
|
| 63 |
+
</button>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
{/* Mobile Navigation */}
|
| 68 |
+
{isMobileMenuOpen && (
|
| 69 |
+
<div className="md:hidden absolute top-full left-0 right-0 bg-margins-black border-t border-margins-dark">
|
| 70 |
+
<nav className="flex flex-col py-4">
|
| 71 |
+
{navLinks.map((link) => (
|
| 72 |
+
<a
|
| 73 |
+
key={link.href}
|
| 74 |
+
href={link.href}
|
| 75 |
+
className="px-6 py-3 text-sm uppercase tracking-widest text-margins-gray hover:text-white hover:bg-margins-dark transition-colors"
|
| 76 |
+
onClick={() => setIsMobileMenuOpen(false)}
|
| 77 |
+
>
|
| 78 |
+
{link.label}
|
| 79 |
+
</a>
|
| 80 |
+
))}
|
| 81 |
+
<a
|
| 82 |
+
href="https://huggingface.co/spaces/akhaliq/anycoder"
|
| 83 |
+
target="_blank"
|
| 84 |
+
rel="noopener noreferrer"
|
| 85 |
+
className="px-6 py-3 text-xs uppercase tracking-widest text-margins-gray hover:text-white hover:bg-margins-dark transition-colors"
|
| 86 |
+
>
|
| 87 |
+
Built with anycoder
|
| 88 |
+
</a>
|
| 89 |
+
</nav>
|
| 90 |
+
</div>
|
| 91 |
+
)}
|
| 92 |
+
</header>
|
| 93 |
+
)
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
export default Header
|