class CustomAdminNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// User dropdown toggle
const userMenuButton = this.shadowRoot.getElementById('user-menu-button');
const userDropdown = this.shadowRoot.getElementById('user-dropdown');
userMenuButton.addEventListener('click', () => {
userDropdown.classList.toggle('show');
feather.replace();
});
// Close dropdown when clicking outside
document.addEventListener('click', (e) => {
if (!e.composedPath().includes(this.shadowRoot.getElementById('user-menu-button'))) {
userDropdown.classList.remove('show');
}
});
}
}
customElements.define('custom-admin-navbar', CustomAdminNavbar);