Spaces:
Build error
Build error
Upload components/Navigation.jsx with huggingface_hub
Browse files- components/Navigation.jsx +135 -0
components/Navigation.jsx
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
+
import { Menu, X, Cpu, Zap, Terminal, Code, Layers } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const navItems = [
|
| 5 |
+
{ name: 'Workbench', href: '#workbench', icon: Terminal },
|
| 6 |
+
{ name: 'Lab Notes', href: '#lab-notes', icon: Code },
|
| 7 |
+
{ name: 'Experiments', href: '#experiments', icon: Zap },
|
| 8 |
+
{ name: 'Arsenal', href: '#arsenal', icon: Layers },
|
| 9 |
+
{ name: 'Connect', href: '#connect', icon: Cpu },
|
| 10 |
+
];
|
| 11 |
+
|
| 12 |
+
export default function Navigation() {
|
| 13 |
+
const [isOpen, setIsOpen] = useState(false);
|
| 14 |
+
const [scrolled, setScrolled] = useState(false);
|
| 15 |
+
const [activeSection, setActiveSection] = useState('');
|
| 16 |
+
|
| 17 |
+
useEffect(() => {
|
| 18 |
+
const handleScroll = () => {
|
| 19 |
+
setScrolled(window.scrollY > 50);
|
| 20 |
+
|
| 21 |
+
// Update active section based on scroll position
|
| 22 |
+
const sections = navItems.map(item => item.href.slice(1));
|
| 23 |
+
for (const section of sections.reverse()) {
|
| 24 |
+
const element = document.getElementById(section);
|
| 25 |
+
if (element) {
|
| 26 |
+
const rect = element.getBoundingClientRect();
|
| 27 |
+
if (rect.top <= 100) {
|
| 28 |
+
setActiveSection(section);
|
| 29 |
+
break;
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
| 36 |
+
return () => window.removeEventListener('scroll', handleScroll);
|
| 37 |
+
}, []);
|
| 38 |
+
|
| 39 |
+
const scrollToSection = (href) => {
|
| 40 |
+
const element = document.querySelector(href);
|
| 41 |
+
if (element) {
|
| 42 |
+
element.scrollIntoView({ behavior: 'smooth' });
|
| 43 |
+
}
|
| 44 |
+
setIsOpen(false);
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
return (
|
| 48 |
+
<>
|
| 49 |
+
<nav className={`fixed top-0 left-0 right-0 z-50 transition-all duration-500 ${scrolled ? 'bg-iron-900/90 backdrop-blur-xl border-b border-iron-600/30' : 'bg-transparent'}`}>
|
| 50 |
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 51 |
+
<div className="flex items-center justify-between h-16 md:h-20">
|
| 52 |
+
{/* Logo */}
|
| 53 |
+
<a href="#" className="flex items-center gap-3 group">
|
| 54 |
+
<div className="relative">
|
| 55 |
+
<div className="w-10 h-10 bg-gradient-to-br from-electric-500 to-magma-500 rounded-lg flex items-center justify-center transform group-hover:rotate-12 transition-transform duration-300">
|
| 56 |
+
<Cpu className="w-6 h-6 text-iron-900" />
|
| 57 |
+
</div>
|
| 58 |
+
<div className="absolute inset-0 bg-electric-500 rounded-lg blur-lg opacity-50 group-hover:opacity-75 transition-opacity" />
|
| 59 |
+
</div>
|
| 60 |
+
<span className="font-mono font-bold text-xl tracking-tight">
|
| 61 |
+
<span className="text-electric-500">IRON</span>
|
| 62 |
+
<span className="text-iron-200">_LABS</span>
|
| 63 |
+
</span>
|
| 64 |
+
</a>
|
| 65 |
+
|
| 66 |
+
{/* Desktop Navigation */}
|
| 67 |
+
<div className="hidden md:flex items-center gap-1">
|
| 68 |
+
{navItems.map((item) => {
|
| 69 |
+
const Icon = item.icon;
|
| 70 |
+
const isActive = activeSection === item.href.slice(1);
|
| 71 |
+
return (
|
| 72 |
+
<button
|
| 73 |
+
key={item.name}
|
| 74 |
+
onClick={() => scrollToSection(item.href)}
|
| 75 |
+
className={`group relative px-4 py-2 rounded-lg transition-all duration-300 ${isActive ? 'text-electric-500' : 'text-iron-300 hover:text-iron-100'}`}
|
| 76 |
+
>
|
| 77 |
+
<span className="flex items-center gap-2 font-mono text-sm">
|
| 78 |
+
<Icon className="w-4 h-4" />
|
| 79 |
+
{item.name}
|
| 80 |
+
</span>
|
| 81 |
+
{isActive && (
|
| 82 |
+
<span className="absolute bottom-0 left-1/2 -translate-x-1/2 w-1 h-1 bg-electric-500 rounded-full" />
|
| 83 |
+
)}
|
| 84 |
+
<span className="absolute inset-0 bg-iron-600/20 rounded-lg scale-0 group-hover:scale-100 transition-transform duration-300" />
|
| 85 |
+
</button>
|
| 86 |
+
);
|
| 87 |
+
})}
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
{/* CTA Button */}
|
| 91 |
+
<div className="hidden md:block">
|
| 92 |
+
<button className="relative px-6 py-2.5 bg-gradient-to-r from-electric-500 to-electric-400 text-iron-900 font-mono font-semibold text-sm rounded-lg overflow-hidden group">
|
| 93 |
+
<span className="relative z-10">INITIATE</span>
|
| 94 |
+
<div className="absolute inset-0 bg-gradient-to-r from-magma-500 to-electric-500 opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
|
| 95 |
+
</button>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
{/* Mobile Menu Button */}
|
| 99 |
+
<button
|
| 100 |
+
onClick={() => setIsOpen(!isOpen)}
|
| 101 |
+
className="md:hidden p-2 text-iron-200 hover:text-electric-500 transition-colors"
|
| 102 |
+
>
|
| 103 |
+
{isOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
| 104 |
+
</button>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
{/* Mobile Menu */}
|
| 109 |
+
<div className={`md:hidden absolute top-full left-0 right-0 bg-iron-900/95 backdrop-blur-xl border-b border-iron-600/30 transition-all duration-300 ${isOpen ? 'opacity-100 visible' : 'opacity-0 invisible'}`}>
|
| 110 |
+
<div className="px-4 py-6 space-y-2">
|
| 111 |
+
{navItems.map((item) => {
|
| 112 |
+
const Icon = item.icon;
|
| 113 |
+
return (
|
| 114 |
+
<button
|
| 115 |
+
key={item.name}
|
| 116 |
+
onClick={() => scrollToSection(item.href)}
|
| 117 |
+
className="w-full flex items-center gap-3 px-4 py-3 text-iron-300 hover:text-electric-500 hover:bg-iron-800/50 rounded-lg transition-all font-mono"
|
| 118 |
+
>
|
| 119 |
+
<Icon className="w-5 h-5" />
|
| 120 |
+
{item.name}
|
| 121 |
+
</button>
|
| 122 |
+
);
|
| 123 |
+
})}
|
| 124 |
+
<button className="w-full mt-4 px-6 py-3 bg-gradient-to-r from-electric-500 to-electric-400 text-iron-900 font-mono font-semibold rounded-lg">
|
| 125 |
+
INITIATE SEQUENCE
|
| 126 |
+
</button>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</nav>
|
| 130 |
+
|
| 131 |
+
{/* Progress Bar */}
|
| 132 |
+
<div className="fixed top-0 left-0 h-0.5 bg-gradient-to-r from-electric-500 via-magma-500 to-gold-500 z-50" id="progress-bar" style={{ width: '0%' }} />
|
| 133 |
+
</>
|
| 134 |
+
);
|
| 135 |
+
}
|