| class DocNavbar extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| :host { |
| position: fixed; |
| top: 0; |
| left: 0; |
| right: 0; |
| z-index: 1000; |
| } |
| |
| nav { |
| background: rgba(17, 24, 39, 0.8); |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| border-bottom: 1px solid rgba(255, 255, 255, 0.1); |
| transition: all 0.3s ease; |
| } |
| |
| .nav-wrapper { |
| max-width: 7xl; |
| margin: 0 auto; |
| padding: 1rem 2rem; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| |
| .logo { |
| display: flex; |
| align-items: center; |
| gap: 0.75rem; |
| font-size: 1.5rem; |
| font-weight: bold; |
| background: linear-gradient(to right, #06b6d4, #8b5cf6); |
| -webkit-background-clip: text; |
| -webkit-text-fill-color: transparent; |
| text-decoration: none; |
| transition: all 0.3s ease; |
| } |
| |
| .logo:hover { |
| transform: scale(1.05); |
| } |
| |
| .nav-links { |
| display: flex; |
| gap: 2rem; |
| align-items: center; |
| } |
| |
| .nav-link { |
| color: #d1d5db; |
| text-decoration: none; |
| transition: all 0.3s ease; |
| position: relative; |
| } |
| |
| .nav-link:hover { |
| color: #06b6d4; |
| } |
| |
| .nav-link::after { |
| content: ''; |
| position: absolute; |
| bottom: -4px; |
| left: 0; |
| width: 0; |
| height: 2px; |
| background: linear-gradient(to right, #06b6d4, #8b5cf6); |
| transition: width 0.3s ease; |
| } |
| |
| .nav-link:hover::after { |
| width: 100%; |
| } |
| |
| .cta-button { |
| background: linear-gradient(to right, #06b6d4, #8b5cf6); |
| color: white; |
| padding: 0.75rem 1.5rem; |
| border-radius: 9999px; |
| text-decoration: none; |
| font-weight: 600; |
| transition: all 0.3s ease; |
| } |
| |
| .cta-button:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 10px 20px rgba(6, 182, 212, 0.3); |
| } |
| |
| .mobile-menu-toggle { |
| display: none; |
| background: none; |
| border: none; |
| color: white; |
| cursor: pointer; |
| padding: 0.5rem; |
| } |
| |
| .mobile-menu { |
| display: none; |
| position: absolute; |
| top: 100%; |
| left: 0; |
| right: 0; |
| background: rgba(17, 24, 39, 0.95); |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| padding: 2rem; |
| gap: 1.5rem; |
| flex-direction: column; |
| } |
| |
| .mobile-menu.active { |
| display: flex; |
| } |
| |
| @media (max-width: 768px) { |
| .nav-links { |
| display: none; |
| } |
| |
| .mobile-menu-toggle { |
| display: block; |
| } |
| } |
| </style> |
| |
| <nav> |
| <div class="nav-wrapper"> |
| <a href="/" class="logo"> |
| <i data-feather="cpu"></i> |
| Arduino DocVortex |
| </a> |
| |
| <div class="nav-links"> |
| <a href="#boards" class="nav-link">Boards</a> |
| <a href="code.html" class="nav-link">Code Reference</a> |
| <a href="#tutorials" class="nav-link">Tutorials</a> |
| <a href="#libraries" class="nav-link">Libraries</a> |
| <a href="code.html" class="cta-button">Get Started</a> |
| </div> |
| <button class="mobile-menu-toggle" data-mobile-menu-toggle> |
| <i data-feather="menu" class="w-6 h-6"></i> |
| </button> |
| </div> |
| <div class="mobile-menu" data-mobile-menu> |
| <a href="#boards" class="nav-link">Boards</a> |
| <a href="code.html" class="nav-link">Code Reference</a> |
| <a href="#tutorials" class="nav-link">Tutorials</a> |
| <a href="#libraries" class="nav-link">Libraries</a> |
| <a href="code.html" class="cta-button">Get Started</a> |
| </div> |
| </nav> |
| `; |
| |
| |
| setTimeout(() => { |
| const toggle = this.shadowRoot.querySelector('[data-mobile-menu-toggle]'); |
| const menu = this.shadowRoot.querySelector('[data-mobile-menu]'); |
| |
| if (toggle && menu) { |
| toggle.addEventListener('click', () => { |
| menu.classList.toggle('active'); |
| }); |
| } |
| |
| |
| if (typeof feather !== 'undefined') { |
| feather.replace({ |
| 'stroke-width': 2, |
| 'height': 24, |
| 'width': 24 |
| }); |
| } |
| }, 100); |
| |
| |
| window.addEventListener('scroll', () => { |
| const nav = this.shadowRoot.querySelector('nav'); |
| if (window.scrollY > 50) { |
| nav.style.background = 'rgba(17, 24, 39, 0.95)'; |
| nav.style.boxShadow = '0 4px 20px rgba(0, 0, 0, 0.3)'; |
| } else { |
| nav.style.background = 'rgba(17, 24, 39, 0.8)'; |
| nav.style.boxShadow = 'none'; |
| } |
| }); |
| } |
| } |
|
|
| customElements.define('doc-navbar', DocNavbar); |