class CustomNavbar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Add theme toggle functionality const themeToggle = this.shadowRoot.querySelector('.theme-toggle'); themeToggle.addEventListener('click', () => { const isDark = document.documentElement.classList.contains('dark'); if (isDark) { document.documentElement.classList.remove('dark'); localStorage.setItem('theme', 'light'); this.shadowRoot.querySelector('i[data-feather="moon"]').setAttribute('data-feather', 'sun'); } else { document.documentElement.classList.add('dark'); localStorage.setItem('theme', 'dark'); this.shadowRoot.querySelector('i[data-feather="sun"]').setAttribute('data-feather', 'moon'); } feather.replace(); }); } } customElements.define('custom-navbar', CustomNavbar);