| class CustomNavbar extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.render(); |
| this.initScrollBehavior(); |
| } |
|
|
| render() { |
| this.shadowRoot.innerHTML = ` |
| <style> |
| :host { |
| display: block; |
| position: fixed; |
| top: 0; |
| left: 0; |
| right: 0; |
| z-index: 1000; |
| } |
| |
| nav { |
| background: rgba(15, 23, 42, 0.8); |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| border-bottom: 1px solid rgba(148, 163, 184, 0.1); |
| transition: all 0.3s ease; |
| } |
| |
| nav.scrolled { |
| background: rgba(15, 23, 42, 0.95); |
| box-shadow: 0 4px 30px rgba(2, 8, 20, 0.5); |
| } |
| |
| .nav-container { |
| max-width: 1400px; |
| margin: 0 auto; |
| padding: 1rem 1.5rem; |
| display: flex; |
| align-items: center; |
| justify-content: space-between; |
| } |
| |
| .logo { |
| display: flex; |
| align-items: center; |
| gap: 0.75rem; |
| text-decoration: none; |
| color: inherit; |
| } |
| |
| .logo-icon { |
| width: 40px; |
| height: 40px; |
| background: linear-gradient(135deg, #0ea5e9, #d946ef); |
| border-radius: 12px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| font-size: 1.5rem; |
| animation: spin 20s linear infinite; |
| } |
| |
| @keyframes spin { |
| from { transform: rotate(0deg); } |
| to { transform: rotate(360deg); } |
| } |
| |
| .logo-text { |
| font-size: 1.5rem; |
| font-weight: 700; |
| background: linear-gradient(135deg, #0ea5e9, #d946ef); |
| -webkit-background-clip: text; |
| -webkit-text-fill-color: transparent; |
| } |
| |
| .nav-links { |
| display: flex; |
| align-items: center; |
| gap: 2rem; |
| list-style: none; |
| } |
| |
| .nav-links a { |
| color: #94a3b8; |
| text-decoration: none; |
| font-size: 0.875rem; |
| font-weight: 500; |
| transition: color 0.2s ease; |
| position: relative; |
| } |
| |
| .nav-links a:hover { |
| color: #0ea5e9; |
| } |
| |
| .nav-links a::after { |
| content: ''; |
| position: absolute; |
| bottom: -4px; |
| left: 0; |
| width: 0; |
| height: 2px; |
| background: linear-gradient(90deg, #0ea5e9, #d946ef); |
| transition: width 0.3s ease; |
| } |
| |
| .nav-links a:hover::after { |
| width: 100%; |
| } |
| |
| .nav-actions { |
| display: flex; |
| align-items: center; |
| gap: 1rem; |
| } |
| |
| .btn-primary { |
| padding: 0.625rem 1.25rem; |
| background: linear-gradient(135deg, #0ea5e9, #d946ef); |
| border: none; |
| border-radius: 9999px; |
| color: white; |
| font-size: 0.875rem; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.3s ease; |
| text-decoration: none; |
| display: inline-flex; |
| align-items: center; |
| gap: 0.5rem; |
| } |
| |
| .btn-primary:hover { |
| transform: scale(1.05); |
| box-shadow: 0 10px 40px rgba(14, 165, 233, 0.4); |
| } |
| |
| .btn-secondary { |
| padding: 0.625rem 1.25rem; |
| background: rgba(30, 41, 59, 0.5); |
| border: 1px solid rgba(148, 163, 184, 0.2); |
| border-radius: 9999px; |
| color: #e2e8f0; |
| font-size: 0.875rem; |
| font-weight: 500; |
| cursor: pointer; |
| transition: all 0.3s ease; |
| text-decoration: none; |
| } |
| |
| .btn-secondary:hover { |
| background: rgba(30, 41, 59, 0.8); |
| border-color: #0ea5e9; |
| } |
| |
| .mobile-menu-btn { |
| display: none; |
| background: none; |
| border: none; |
| color: #e2e8f0; |
| cursor: pointer; |
| padding: 0.5rem; |
| } |
| |
| @media (max-width: 1024px) { |
| .nav-links { |
| display: none; |
| } |
| |
| .mobile-menu-btn { |
| display: block; |
| } |
| |
| .nav-actions .btn-secondary { |
| display: none; |
| } |
| } |
| </style> |
| |
| <nav id="navbar"> |
| <div class="nav-container"> |
| <a href="index.html" class="logo"> |
| <div class="logo-icon">๐</div> |
| <span class="logo-text">Vortex Cortex</span> |
| </a> |
| |
| <ul class="nav-links"> |
| <li><a href="#studio">Studio</a></li> |
| <li><a href="#gallery">Gallery</a></li> |
| <li><a href="#pricing">Pricing</a></li> |
| <li><a href="#api">API</a></li> |
| </ul> |
| <div class="nav-actions"> |
| <a href="login.html" class="btn-secondary">Sign In</a> |
| <a href="#studio" class="btn-primary"> |
| <i data-feather="zap" style="width: 16px; height: 16px;"></i> |
| Start Creating |
| </a> |
| <button class="mobile-menu-btn"> |
| <i data-feather="menu"></i> |
| </button> |
| </div> |
| </div> |
| </nav> |
| `; |
| } |
|
|
| initScrollBehavior() { |
| const navbar = this.shadowRoot.getElementById('navbar'); |
| let lastScroll = 0; |
|
|
| window.addEventListener('scroll', () => { |
| const currentScroll = window.pageYOffset; |
| |
| if (currentScroll > 100) { |
| navbar.classList.add('scrolled'); |
| } else { |
| navbar.classList.remove('scrolled'); |
| } |
| |
| lastScroll = currentScroll; |
| }); |
| } |
| } |
|
|
| customElements.define('custom-navbar', CustomNavbar); |