| class CustomNavbar extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| :host { |
| display: block; |
| position: fixed; |
| top: 0; |
| left: 0; |
| right: 0; |
| z-index: 50; |
| background-color: rgba(255, 255, 255, 0.95); |
| backdrop-filter: blur(10px); |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); |
| } |
| .container { |
| max-width: 1200px; |
| margin: 0 auto; |
| padding: 1rem 2rem; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| .logo { |
| font-weight: 700; |
| font-size: 1.5rem; |
| color: var(--primary); |
| display: flex; |
| align-items: center; |
| gap: 0.5rem; |
| } |
| .nav-links { |
| display: flex; |
| gap: 2rem; |
| } |
| .nav-link { |
| font-weight: 500; |
| color: #4b5563; |
| transition: color 0.2s; |
| } |
| .nav-link:hover { |
| color: var(--primary); |
| } |
| .mobile-menu-button { |
| display: none; |
| } |
| .mobile-menu { |
| display: none; |
| } |
| @media (max-width: 768px) { |
| .nav-links { |
| display: none; |
| } |
| .mobile-menu-button { |
| display: block; |
| } |
| .mobile-menu { |
| position: absolute; |
| top: 100%; |
| left: 0; |
| right: 0; |
| background-color: white; |
| padding: 1rem; |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); |
| } |
| .mobile-menu.active { |
| display: block; |
| } |
| .mobile-links { |
| display: flex; |
| flex-direction: column; |
| gap: 1rem; |
| } |
| } |
| </style> |
| <div class="container"> |
| <a href="#" class="logo"> |
| <span class="gradient-text">PixelPulse</span> |
| </a> |
| |
| <div class="nav-links"> |
| <a href="#services" class="nav-link">Services</a> |
| <a href="#portfolio" class="nav-link">Portfolio</a> |
| <a href="#testimonials" class="nav-link">Testimonials</a> |
| <a href="#contact" class="nav-link">Contact</a> |
| </div> |
| |
| <button class="mobile-menu-button" data-menu-toggle> |
| <i data-feather="menu"></i> |
| </button> |
| |
| <div class="mobile-menu hidden" data-menu> |
| <div class="mobile-links"> |
| <a href="#services" class="nav-link">Services</a> |
| <a href="#portfolio" class="nav-link">Portfolio</a> |
| <a href="#testimonials" class="nav-link">Testimonials</a> |
| <a href="#contact" class="nav-link">Contact</a> |
| </div> |
| </div> |
| </div> |
| `; |
| } |
| } |
| customElements.define('custom-navbar', CustomNavbar); |