| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| } | |
| nav { | |
| background-color: white; | |
| box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); | |
| } | |
| .dark nav { | |
| background-color: #1f2937; | |
| box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); | |
| } | |
| .nav-container { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 1rem 2rem; | |
| max-width: 100vw; | |
| margin: 0 auto; | |
| } | |
| .logo { | |
| font-weight: 700; | |
| font-size: 1.5rem; | |
| color: #7C3AED; | |
| } | |
| .dark .logo { | |
| color: #A78BFA; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| align-items: center; | |
| } | |
| .nav-link { | |
| color: #4B5563; | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.2s; | |
| } | |
| .dark .nav-link { | |
| color: #D1D5DB; | |
| } | |
| .nav-link:hover { | |
| color: #7C3AED; | |
| } | |
| .dark .nav-link:hover { | |
| color: #A78BFA; | |
| } | |
| .theme-toggle-btn { | |
| background: none; | |
| border: none; | |
| cursor: pointer; | |
| color: #4B5563; | |
| transition: color 0.2s; | |
| } | |
| .dark .theme-toggle-btn { | |
| color: #D1D5DB; | |
| } | |
| .theme-toggle-btn:hover { | |
| color: #7C3AED; | |
| } | |
| .dark .theme-toggle-btn:hover { | |
| color: #A78BFA; | |
| } | |
| </style> | |
| <nav> | |
| <div class="nav-container"> | |
| <a href="/" class="logo flex items-center"> | |
| <i data-feather="sparkles" class="mr-2"></i> PixGenius | |
| </a> | |
| <div class="nav-links"> | |
| <a href="#" class="nav-link">Explore</a> | |
| <a href="#" class="nav-link">Pricing</a> | |
| <a href="#" class="nav-link">Docs</a> | |
| <button class="theme-toggle-btn"> | |
| <i data-feather="moon"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |