File size: 6,051 Bytes
71994e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { useState, useEffect } from 'react';
import { Menu, X, Cpu, Zap, Terminal, Code, Layers } from 'lucide-react';

const navItems = [
  { name: 'Workbench', href: '#workbench', icon: Terminal },
  { name: 'Lab Notes', href: '#lab-notes', icon: Code },
  { name: 'Experiments', href: '#experiments', icon: Zap },
  { name: 'Arsenal', href: '#arsenal', icon: Layers },
  { name: 'Connect', href: '#connect', icon: Cpu },
];

export default function Navigation() {
  const [isOpen, setIsOpen] = useState(false);
  const [scrolled, setScrolled] = useState(false);
  const [activeSection, setActiveSection] = useState('');

  useEffect(() => {
    const handleScroll = () => {
      setScrolled(window.scrollY > 50);
      
      // Update active section based on scroll position
      const sections = navItems.map(item => item.href.slice(1));
      for (const section of sections.reverse()) {
        const element = document.getElementById(section);
        if (element) {
          const rect = element.getBoundingClientRect();
          if (rect.top <= 100) {
            setActiveSection(section);
            break;
          }
        }
      }
    };

    window.addEventListener('scroll', handleScroll, { passive: true });
    return () => window.removeEventListener('scroll', handleScroll);
  }, []);

  const scrollToSection = (href) => {
    const element = document.querySelector(href);
    if (element) {
      element.scrollIntoView({ behavior: 'smooth' });
    }
    setIsOpen(false);
  };

  return (
    <>
      <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'}`}>
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="flex items-center justify-between h-16 md:h-20">
            {/* Logo */}
            <a href="#" className="flex items-center gap-3 group">
              <div className="relative">
                <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">
                  <Cpu className="w-6 h-6 text-iron-900" />
                </div>
                <div className="absolute inset-0 bg-electric-500 rounded-lg blur-lg opacity-50 group-hover:opacity-75 transition-opacity" />
              </div>
              <span className="font-mono font-bold text-xl tracking-tight">
                <span className="text-electric-500">IRON</span>
                <span className="text-iron-200">_LABS</span>
              </span>
            </a>

            {/* Desktop Navigation */}
            <div className="hidden md:flex items-center gap-1">
              {navItems.map((item) => {
                const Icon = item.icon;
                const isActive = activeSection === item.href.slice(1);
                return (
                  <button
                    key={item.name}
                    onClick={() => scrollToSection(item.href)}
                    className={`group relative px-4 py-2 rounded-lg transition-all duration-300 ${isActive ? 'text-electric-500' : 'text-iron-300 hover:text-iron-100'}`}
                  >
                    <span className="flex items-center gap-2 font-mono text-sm">
                      <Icon className="w-4 h-4" />
                      {item.name}
                    </span>
                    {isActive && (
                      <span className="absolute bottom-0 left-1/2 -translate-x-1/2 w-1 h-1 bg-electric-500 rounded-full" />
                    )}
                    <span className="absolute inset-0 bg-iron-600/20 rounded-lg scale-0 group-hover:scale-100 transition-transform duration-300" />
                  </button>
                );
              })}
            </div>

            {/* CTA Button */}
            <div className="hidden md:block">
              <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">
                <span className="relative z-10">INITIATE</span>
                <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" />
              </button>
            </div>

            {/* Mobile Menu Button */}
            <button
              onClick={() => setIsOpen(!isOpen)}
              className="md:hidden p-2 text-iron-200 hover:text-electric-500 transition-colors"
            >
              {isOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
            </button>
          </div>
        </div>

        {/* Mobile Menu */}
        <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'}`}>
          <div className="px-4 py-6 space-y-2">
            {navItems.map((item) => {
              const Icon = item.icon;
              return (
                <button
                  key={item.name}
                  onClick={() => scrollToSection(item.href)}
                  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"
                >
                  <Icon className="w-5 h-5" />
                  {item.name}
                </button>
              );
            })}
            <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">
              INITIATE SEQUENCE
            </button>
          </div>
        </div>
      </nav>

      {/* Progress Bar */}
      <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%' }} />
    </>
  );
}