Spaces:
Running
Running
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%); | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); | |
| } | |
| .logo { | |
| color: white; | |
| font-weight: bold; | |
| font-size: 1.5rem; | |
| letter-spacing: 1px; | |
| } | |
| ul { | |
| display: flex; | |
| gap: 2rem; | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| a { | |
| color: white; | |
| text-decoration: none; | |
| transition: all 0.3s; | |
| font-weight: 500; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| } | |
| a:hover { | |
| transform: translateY(-2px); | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| gap: 1rem; | |
| } | |
| ul { | |
| flex-direction: column; | |
| gap: 0.5rem; | |
| align-items: center; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <div class="logo">cool cool</div> | |
| <ul> | |
| <li><a href="/"><i data-feather="home"></i> Home</a></li> | |
| <li><a href="#"><i data-feather="info"></i> About</a></li> | |
| <li><a href="#"><i data-feather="mail"></i> Contact</a></li> | |
| </ul> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |