Spaces:
Running
Running
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background-color: rgba(255, 255, 255, 0.8); | |
| backdrop-filter: blur(10px); | |
| } | |
| .nav-link { | |
| position: relative; | |
| } | |
| .nav-link::after { | |
| content: ''; | |
| position: absolute; | |
| width: 0; | |
| height: 2px; | |
| bottom: 0; | |
| left: 0; | |
| background-color: #9ca3af; | |
| transition: width 0.3s ease; | |
| } | |
| .nav-link:hover::after { | |
| width: 100%; | |
| } | |
| </style> | |
| <header> | |
| <nav class="fixed w-full z-10 border-b border-gray-100 shadow-sm"> | |
| <div class="container mx-auto px-4 py-4 flex justify-between items-center"> | |
| <a href="/" class="text-2xl font-bold text-secondary-dark">Chromatic</a> | |
| <div class="hidden md:flex space-x-8 items-center"> | |
| <a href="#" class="nav-link text-secondary-DEFAULT hover:text-secondary-dark">Explore</a> | |
| <a href="#" class="nav-link text-secondary-DEFAULT hover:text-secondary-dark">Create</a> | |
| <a href="#" class="nav-link text-secondary-DEFAULT hover:text-secondary-dark">Generate</a> | |
| <a href="#" class="nav-link text-secondary-DEFAULT hover:text-secondary-dark">About</a> | |
| <button id="color-mode-toggle" class="p-2 rounded-full hover:bg-gray-100"> | |
| <i data-feather="moon" class="text-secondary-DEFAULT"></i> | |
| </button> | |
| </div> | |
| <button class="md:hidden p-2"> | |
| <i data-feather="menu" class="text-secondary-DEFAULT"></i> | |
| </button> | |
| </div> | |
| </nav> | |
| </header> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |