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