Spaces:
Running
Running
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .nav-link { | |
| position: relative; | |
| } | |
| .nav-link:after { | |
| content: ''; | |
| position: absolute; | |
| width: 0; | |
| height: 2px; | |
| bottom: -2px; | |
| left: 0; | |
| background-color: #0d9488; | |
| transition: width 0.3s ease; | |
| } | |
| .nav-link:hover:after { | |
| width: 100%; | |
| } | |
| #mobile-menu { | |
| transition: all 0.3s ease; | |
| } | |
| </style> | |
| <nav class="fixed w-full bg-white shadow-sm z-50"> | |
| <div class="container mx-auto px-6 py-4"> | |
| <div class="flex justify-between items-center"> | |
| <!-- Logo --> | |
| <a href="/" class="flex items-center"> | |
| <i data-feather="feather" class="text-teal-600 w-8 h-8 mr-2"></i> | |
| <span class="text-xl font-bold text-teal-800">Holistic Glow</span> | |
| </a> | |
| <!-- Desktop Menu --> | |
| <div class="hidden md:flex space-x-8"> | |
| <a href="/" class="nav-link text-gray-700 hover:text-teal-600">Home</a> | |
| <a href="#services" class="nav-link text-gray-700 hover:text-teal-600">Services</a> | |
| <a href="#about" class="nav-link text-gray-700 hover:text-teal-600">About</a> | |
| <a href="#" class="nav-link text-gray-700 hover:text-teal-600">Blog</a> | |
| <a href="#" class="nav-link text-gray-700 hover:text-teal-600">Contact</a> | |
| </div> | |
| <!-- Mobile menu button --> | |
| <div class="md:hidden"> | |
| <button onclick="toggleMobileMenu()" class="text-gray-700 focus:outline-none"> | |
| <i data-feather="menu" class="w-6 h-6"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Mobile Menu --> | |
| <div id="mobile-menu" class="hidden md:hidden mt-4 pb-4"> | |
| <a href="/" class="block py-2 text-gray-700 hover:text-teal-600">Home</a> | |
| <a href="#services" class="block py-2 text-gray-700 hover:text-teal-600">Services</a> | |
| <a href="#about" class="block py-2 text-gray-700 hover:text-teal-600">About</a> | |
| <a href="#" class="block py-2 text-gray-700 hover:text-teal-600">Blog</a> | |
| <a href="#" class="block py-2 text-gray-700 hover:text-teal-600">Contact</a> | |
| </div> | |
| </div> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |