class CustomNavbar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Initialize Feather icons const featherScript = document.createElement('script'); featherScript.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js'; this.shadowRoot.appendChild(featherScript); featherScript.onload = () => { if (window.feather) { window.feather.replace(); } // Mobile menu toggle const mobileMenuBtn = this.shadowRoot.querySelector('.mobile-menu-btn'); const navLinks = this.shadowRoot.querySelector('.nav-links'); if (mobileMenuBtn && navLinks) { mobileMenuBtn.addEventListener('click', () => { navLinks.classList.toggle('active'); const icon = mobileMenuBtn.querySelector('i'); if (navLinks.classList.contains('active')) { icon.setAttribute('data-feather', 'x'); } else { icon.setAttribute('data-feather', 'menu'); } window.feather.replace(); }); } }; } } customElements.define('custom-navbar', CustomNavbar);