class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Mobile menu toggle
const menuButton = this.shadowRoot.getElementById('mobile-menu-button');
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
menuButton.addEventListener('click', () => {
const isOpen = mobileMenu.style.display === 'flex';
mobileMenu.style.display = isOpen ? 'none' : 'flex';
menuButton.textContent = isOpen ? '☰' : '✕';
});
}
}
customElements.define('custom-navbar', CustomNavbar);