class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Initialize mobile menu toggle
this.shadowRoot.getElementById('mobile-menu-button').addEventListener('click', () => {
const menu = this.shadowRoot.getElementById('mobile-menu');
menu.classList.toggle('open');
// Change icon
const icon = this.shadowRoot.querySelector('#mobile-menu-button i');
if (menu.classList.contains('open')) {
icon.setAttribute('data-feather', 'x');
} else {
icon.setAttribute('data-feather', 'menu');
}
feather.replace();
});
}
}
customElements.define('custom-navbar', CustomNavbar);