PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.13
Yatra – Travel Booking & Tour Operator Software v3.0.13
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / resources / js / components / ui / alert.tsx

alert.tsx in Yatra – Travel Booking & Tour Operator Software 3.0.13, at resources/js/components/ui/alert.tsx

67 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Alert Component
3 * Displays important messages to users
4 */
5
6 import React from "react";
7 import { AlertCircle, CheckCircle, Info, XCircle, X } from "lucide-react";
8 import { __ } from "../../lib/i18n";
9
10 interface AlertProps {
11 variant?: "success" | "error" | "warning" | "info";
12 title?: string;
13 children: React.ReactNode;
14 onClose?: () => void;
15 className?: string;
16 }
17
18 export const Alert: React.FC<AlertProps> = ({
19 variant = "info",
20 title,
21 children,
22 onClose,
23 className = "",
24 }) => {
25 const variantClasses = {
26 success:
27 "bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800",
28 error:
29 "bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800",
30 warning:
31 "bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800",
32 info: "bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800",
33 };
34
35 const icons = {
36 success: CheckCircle,
37 error: XCircle,
38 warning: AlertCircle,
39 info: Info,
40 };
41
42 const Icon = icons[variant];
43
44 return (
45 <div
46 className={`rounded-md border p-4 ${variantClasses[variant]} ${className}`}
47 >
48 <div className="flex items-start gap-3">
49 <Icon className="w-5 h-5 flex-shrink-0 mt-0.5" />
50 <div className="flex-1">
51 {title && <h4 className="font-medium mb-1">{title}</h4>}
52 <div className="text-sm">{children}</div>
53 </div>
54 {onClose && (
55 <button
56 onClick={onClose}
57 className="flex-shrink-0 text-current opacity-70 hover:opacity-100 transition-opacity"
58 aria-label={__("Close", "yatra")}
59 >
60 <X className="w-4 h-4" />
61 </button>
62 )}
63 </div>
64 </div>
65 );
66 };
67