Spaces:
Running
Running
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background-color: white; | |
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | |
| } | |
| .nav-link { | |
| position: relative; | |
| } | |
| .nav-link::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: -4px; | |
| left: 0; | |
| width: 0; | |
| height: 2px; | |
| background-color: #d946ef; | |
| transition: width 0.3s ease; | |
| } | |
| .nav-link:hover::after { | |
| width: 100%; | |
| } | |
| .mobile-menu { | |
| max-height: 0; | |
| overflow: hidden; | |
| transition: max-height 0.3s ease-out; | |
| } | |
| .mobile-menu.open { | |
| max-height: 500px; | |
| } | |
| </style> | |
| <nav class="sticky top-0 z-50"> | |
| <div class="container mx-auto px-4 py-4"> | |
| <div class="flex justify-between items-center"> | |
| <a href="#" class="text-2xl font-bold text-gray-800"> | |
| <span class="text-fuchsia-600">Umesh</span> Shelare | |
| </a> | |
| <!-- Desktop Navigation --> | |
| <div class="hidden md:flex items-center space-x-8"> | |
| <a href="#about" class="nav-link text-gray-600 hover:text-gray-900">About</a> | |
| <a href="#system-design" class="nav-link text-gray-600 hover:text-gray-900">System Design</a> | |
| <a href="#projects" class="nav-link text-gray-600 hover:text-gray-900">Projects</a> | |
| <a href="#contact" class="nav-link text-gray-600 hover:text-gray-900">Contact</a> | |
| <a href="#" class="px-4 py-2 bg-fuchsia-600 text-white rounded-lg hover:bg-fuchsia-700 transition-colors">Resume</a> | |
| </div> | |
| <!-- Mobile menu button --> | |
| <button class="md:hidden focus:outline-none" id="mobile-menu-button"> | |
| <i data-feather="menu" class="text-gray-800"></i> | |
| </button> | |
| </div> | |
| <!-- Mobile Navigation --> | |
| <div class="mobile-menu md:hidden" id="mobile-menu"> | |
| <div class="pt-4 pb-2 space-y-2"> | |
| <a href="#about" class="block px-3 py-2 rounded-md text-gray-600 hover:bg-fuchsia-50">About</a> | |
| <a href="#projects" class="block px-3 py-2 rounded-md text-gray-600 hover:bg-fuchsia-50">Projects</a> | |
| <a href="#contact" class="block px-3 py-2 rounded-md text-gray-600 hover:bg-fuchsia-50">Contact</a> | |
| <a href="#" class="block px-3 py-2 text-center bg-fuchsia-600 text-white rounded-lg hover:bg-fuchsia-700">Resume</a> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <script> | |
| feather.replace(); | |
| document.getElementById('mobile-menu-button').addEventListener('click', function() { | |
| const menu = document.getElementById('mobile-menu'); | |
| menu.classList.toggle('open'); | |
| this.innerHTML = menu.classList.contains('open') | |
| ? '<i data-feather="x"></i>' | |
| : '<i data-feather="menu"></i>'; | |
| feather.replace(); | |
| }); | |
| </script> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |