Spaces:
Running
Running
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| } | |
| header { | |
| background-color: white; | |
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 1rem; | |
| } | |
| .logo { | |
| font-weight: 700; | |
| font-size: 1.5rem; | |
| color: #3b82f6; | |
| } | |
| nav a { | |
| color: #4b5563; | |
| transition: color 0.2s; | |
| } | |
| nav a:hover { | |
| color: #3b82f6; | |
| } | |
| </style> | |
| <header> | |
| <div class="container mx-auto px-4 py-4 flex justify-between items-center"> | |
| <a href="/" class="logo flex items-center"> | |
| <i data-feather="message-square" class="mr-2"></i> | |
| Chatty McRagFace | |
| </a> | |
| <nav class="hidden md:flex space-x-6"> | |
| <a href="#" class="flex items-center"> | |
| <i data-feather="home" class="mr-1"></i> | |
| Home | |
| </a> | |
| <a href="#" class="flex items-center"> | |
| <i data-feather="info" class="mr-1"></i> | |
| About | |
| </a> | |
| <a href="#" class="flex items-center"> | |
| <i data-feather="settings" class="mr-1"></i> | |
| Settings | |
| </a> | |
| </nav> | |
| <button class="md:hidden"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| </div> | |
| </header> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |