source: chapterx-frontend/src/components/ui/Toast.tsx@ 3ae4bab

main
Last change on this file since 3ae4bab was b62cefc, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added frontend and imporoved AI Suggestions service

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import React from 'react'
2import { CheckCircle, XCircle, AlertTriangle, Info, X } from 'lucide-react'
3import { useUIStore } from '../../store/uiStore'
4
5const icons = {
6 success: <CheckCircle size={18} className="text-emerald-400" />,
7 error: <XCircle size={18} className="text-rose-400" />,
8 warning: <AlertTriangle size={18} className="text-amber-400" />,
9 info: <Info size={18} className="text-blue-400" />,
10}
11
12const styles = {
13 success: 'border-emerald-500/30 bg-emerald-500/10',
14 error: 'border-rose-500/30 bg-rose-500/10',
15 warning: 'border-amber-500/30 bg-amber-500/10',
16 info: 'border-blue-500/30 bg-blue-500/10',
17}
18
19export const ToastContainer: React.FC = () => {
20 const { toasts, removeToast } = useUIStore()
21
22 return (
23 <div className="fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none">
24 {toasts.map(toast => (
25 <div
26 key={toast.id}
27 className={`pointer-events-auto flex items-center gap-3 px-4 py-3 rounded-xl border glass shadow-xl min-w-[280px] max-w-sm ${styles[toast.type]} animate-pulse-once`}
28 >
29 {icons[toast.type]}
30 <p className="text-sm text-slate-100 flex-1">{toast.message}</p>
31 <button
32 onClick={() => removeToast(toast.id)}
33 className="text-slate-400 hover:text-white transition-colors ml-1"
34 >
35 <X size={14} />
36 </button>
37 </div>
38 ))}
39 </div>
40 )
41}
Note: See TracBrowser for help on using the repository browser.