class CustomHeader extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
`; // Add event listeners after rendering setTimeout(() => { const menuBtn = this.shadowRoot.getElementById('menuBtn'); const navLinks = this.shadowRoot.getElementById('navLinks'); menuBtn.addEventListener('click', () => { navLinks.classList.toggle('active'); const menuIcon = menuBtn.querySelector('i'); if (navLinks.classList.contains('active')) { menuIcon.setAttribute('data-feather', 'x'); } else { menuIcon.setAttribute('data-feather', 'menu'); } feather.replace(); }); }, 0); } } customElements.define('custom-header', CustomHeader);