class CustomFooter extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
}
}
// Newsletter form handler
window.handleNewsletter = function(event) {
event.preventDefault();
const email = event.target.querySelector('.newsletter-input').value;
// Create notification
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50 animate-fade-in';
notification.textContent = 'Successfully subscribed to newsletter!';
document.body.appendChild(notification);
// Reset form
event.target.reset();
// Remove notification after 3 seconds
setTimeout(() => {
notification.style.opacity = '0';
setTimeout(() => {
if (notification.parentNode) {
document.body.removeChild(notification);
}
}, 300);
}, 3000);
};
customElements.define('custom-footer', CustomFooter);