/** * toast.js — 토스트 알림 공통 모듈 */ function showToast(message, type = 'success', duration = 3000) { const existing = document.querySelector('.toast-notification'); if (existing) existing.remove(); const iconMap = { success: 'fas fa-check-circle', error: 'fas fa-exclamation-circle', warning: 'fas fa-exclamation-triangle', info: 'fas fa-info-circle' }; const colorMap = { success: 'bg-green-500', error: 'bg-red-500', warning: 'bg-yellow-500', info: 'bg-blue-500' }; const toast = document.createElement('div'); toast.className = `toast-notification fixed top-4 right-4 z-[9999] ${colorMap[type] || colorMap.info} text-white px-6 py-3 rounded-lg shadow-lg flex items-center space-x-2 transform translate-x-full transition-transform duration-300`; toast.innerHTML = ` ${message} `; document.body.appendChild(toast); requestAnimationFrame(() => { toast.style.transform = 'translateX(0)'; }); setTimeout(() => { toast.style.transform = 'translateX(120%)'; setTimeout(() => toast.remove(), 300); }, duration); } // 기존 코드 호환용 별칭 function showToastMessage(message, type = 'success') { showToast(message, type); }