Prima importazione

This commit is contained in:
2026-07-05 10:55:40 +02:00
commit 457c3eacf6
23 changed files with 6384 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
/**
* Toast Notification System
* Usage: Toast.success('Message'), Toast.error('Message'), Toast.info('Message')
*/
const Toast = {
container: null,
init() {
this.container = document.getElementById('toast-container');
},
show(message, type = 'info', duration = 3500) {
if (!this.container) this.init();
const icons = {
success: '✓',
error: '✕',
info: '',
warning: '⚠',
};
const toast = document.createElement('div');
toast.className = `toast toast-${type}`;
toast.innerHTML = `
<span style="font-size:1.1rem;line-height:1;">${icons[type] || ''}</span>
<span>${message}</span>
`;
this.container.appendChild(toast);
// Auto-dismiss
setTimeout(() => {
toast.classList.add('toast-exit');
toast.addEventListener('animationend', () => toast.remove());
}, duration);
},
success(msg) { this.show(msg, 'success'); },
error(msg) { this.show(msg, 'error', 5000); },
info(msg) { this.show(msg, 'info'); },
warning(msg) { this.show(msg, 'warning', 4000); },
};