class NavBar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Mobile menu toggle const mobileMenuBtn = this.shadowRoot.getElementById('mobileMenu'); const navLinks = this.shadowRoot.getElementById('navLinks'); mobileMenuBtn.addEventListener('click', () => { navLinks.classList.toggle('active'); }); // Close menu when clicking a link this.shadowRoot.querySelectorAll('.nav-links a').forEach(link => { link.addEventListener('click', () => { navLinks.classList.remove('active'); }); }); // Add feather icons if (window.feather) { feather.replace({ parent: this.shadowRoot }); } } } customElements.define('nav-bar', NavBar);