class MetroHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
const currentDateElement = this.shadowRoot.getElementById('current-date');
if (currentDateElement) {
const now = new Date();
const options = { weekday: 'short', month: 'short', day: 'numeric' };
currentDateElement.textContent = now.toLocaleDateString('en-US', options);
}
const searchInput = this.shadowRoot.querySelector('.search-input');
if (searchInput) {
searchInput.addEventListener('input', (e) => {
console.log('Searching for:', e.target.value);
});
}
const notificationBtn = this.shadowRoot.querySelector('.notification');
if (notificationBtn) {
notificationBtn.addEventListener('click', () => {
window.MetroPulse?.showNotification('You have 3 new notifications', 'info');
});
}
setTimeout(() => {
const icons = this.shadowRoot.querySelectorAll('[data-feather]');
icons.forEach(icon => {
feather.replace();
});
}, 100);
}
}
customElements.define('metro-header', MetroHeader);