class HeaderComponent extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Initialize feather icons
const featherScript = document.createElement('script');
featherScript.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js';
this.shadowRoot.appendChild(featherScript);
featherScript.onload = () => {
feather.replace();
};
// Mobile menu toggle
this.shadowRoot.getElementById('mobile-menu-button').addEventListener('click', () => {
document.querySelector('sidebar-component').classList.add('open');
document.body.classList.add('overflow-hidden');
});
// Update title based on view
document.addEventListener('navigate', (e) => {
const titles = {
'home': 'Accueil',
'chat': 'Chat Rosalinda',
'projects': 'Mes Projets',
'code': 'Code Généré',
'library': 'Bibliothèque'
};
this.shadowRoot.getElementById('header-title').textContent = titles[e.detail] || 'Accueil';
});
}
}
customElements.define('header-component', HeaderComponent);