| class CustomHeader extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| nav { |
| transition: all 0.3s ease; |
| } |
| .nav-link { |
| position: relative; |
| } |
| .nav-link:after { |
| content: ''; |
| position: absolute; |
| width: 0; |
| height: 2px; |
| bottom: -2px; |
| left: 0; |
| background-color: currentColor; |
| transition: width 0.3s ease; |
| } |
| .nav-link:hover:after { |
| width: 100%; |
| } |
| </style> |
| <header class="bg-white shadow-sm"> |
| <nav class="container mx-auto px-6 py-4"> |
| <div class="flex justify-between items-center"> |
| <a href="/" class="text-2xl font-bold gradient-text">Chromatic</a> |
| <div class="hidden md:flex space-x-8"> |
| <a href="#" class="nav-link text-gray-600 hover:text-primary-600">Home</a> |
| <a href="#" class="nav-link text-gray-600 hover:text-primary-600">Features</a> |
| <a href="#" class="nav-link text-gray-600 hover:text-primary-600">Gallery</a> |
| <a href="#" class="nav-link text-gray-600 hover:text-primary-600">About</a> |
| <a href="#" class="nav-link text-gray-600 hover:text-primary-600">Contact</a> |
| </div> |
| <div class="flex items-center space-x-4"> |
| <button id="color-scheme-toggle" class="p-2 rounded-full hover:bg-gray-100"> |
| <i data-feather="moon" class="text-gray-600"></i> |
| </button> |
| <button class="md:hidden focus:outline-none"> |
| <i data-feather="menu" class="text-gray-600"></i> |
| </button> |
| </div> |
| </div> |
| </nav> |
| </header> |
| `; |
| } |
| } |
| customElements.define('custom-header', CustomHeader); |