class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Инициализация feather icons
const menuIcon = this.shadowRoot.getElementById('menuIcon');
const mobileMenuBtn = this.shadowRoot.getElementById('mobileMenuBtn');
const navLinks = this.shadowRoot.getElementById('navLinks');
// Переключение мобильного меню
mobileMenuBtn.addEventListener('click', () => {
navLinks.classList.toggle('active');
const isOpen = navLinks.classList.contains('active');
menuIcon.setAttribute('data-feather', isOpen ? 'x' : 'menu');
feather.replace();
});
}
}
customElements.define('custom-header', CustomHeader);