Spaces:
Running
Running
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| } | |
| .header { | |
| background-color: rgba(17, 24, 39, 0.9); | |
| backdrop-filter: blur(10px); | |
| border-bottom: 1px solid #374151; | |
| position: sticky; | |
| top: 0; | |
| z-index: 50; | |
| } | |
| .nav-container { | |
| max-width: 1280px; | |
| margin: 0 auto; | |
| padding: 0 1rem; | |
| } | |
| .nav { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 1rem 0; | |
| } | |
| .logo { | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| background: linear-gradient(to right, #10b981, #f97316); | |
| -webkit-background-clip: text; | |
| background-clip: text; | |
| color: transparent; | |
| text-decoration: none; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| } | |
| .nav-link { | |
| color: #d1d5db; | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.3s; | |
| } | |
| .nav-link:hover { | |
| color: #10b981; | |
| } | |
| .nav-button { | |
| background-color: #10b981; | |
| color: white; | |
| border: none; | |
| padding: 0.5rem 1.5rem; | |
| border-radius: 9999px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: background-color 0.3s; | |
| } | |
| .nav-button:hover { | |
| background-color: #059669; | |
| } | |
| .mobile-menu-button { | |
| display: none; | |
| background: none; | |
| border: none; | |
| color: #d1d5db; | |
| cursor: pointer; | |
| } | |
| @media (max-width: 768px) { | |
| .nav-links { | |
| display: none; | |
| } | |
| .mobile-menu-button { | |
| display: block; | |
| } | |
| } | |
| .feather { | |
| width: 20px; | |
| height: 20px; | |
| } | |
| </style> | |
| <header class="header"> | |
| <div class="nav-container"> | |
| <nav class="nav"> | |
| <a href="#" class="logo">EcoGrove</a> | |
| <div class="nav-links"> | |
| <a href="#" class="nav-link">Home</a> | |
| <a href="#" class="nav-link">Tours</a> | |
| <a href="#" class="nav-link">Destinations</a> | |
| <a href="#" class="nav-link">About</a> | |
| <a href="#" class="nav-link">Contact</a> | |
| </div> | |
| <button class="nav-button">Book Now</button> | |
| <button class="mobile-menu-button"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| </nav> | |
| </div> | |
| </header> | |
| `; | |
| // Initialize feather icons | |
| const script = document.createElement('script'); | |
| script.src = "https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"; | |
| script.onload = () => { | |
| if (this.shadowRoot) { | |
| feather.replace(); | |
| } | |
| }; | |
| this.shadowRoot.appendChild(script); | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |