infoalloggi-monorepo/apps/infoalloggi/src/components/payment_status.tsx

55 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-08-28 18:27:07 +02:00
import { AlertCircle, CheckCircle, Loader2 } from "lucide-react";
2025-08-04 17:45:44 +02:00
type PaymentStatus = "success" | "processing" | "error";
interface PaymentStatusProps {
2025-08-28 18:27:07 +02:00
status: PaymentStatus;
title: string;
message?: string;
2025-08-04 17:45:44 +02:00
}
export default function PaymentStatus({
2025-08-28 18:27:07 +02:00
status,
message,
title,
2025-08-04 17:45:44 +02:00
}: PaymentStatusProps) {
2025-08-28 18:27:07 +02:00
const statusConfig = {
2025-08-29 16:18:32 +02:00
error: {
bgColor: "bg-red-50",
borderColor: "border-red-200",
color: "text-red-500",
icon: AlertCircle,
2025-08-28 18:27:07 +02:00
},
processing: {
bgColor: "bg-blue-50",
borderColor: "border-blue-200",
2025-08-29 16:18:32 +02:00
color: "text-blue-500",
icon: Loader2,
2025-08-28 18:27:07 +02:00
},
2025-08-29 16:18:32 +02:00
success: {
bgColor: "bg-green-50",
borderColor: "border-green-200",
color: "text-green-500",
icon: CheckCircle,
2025-08-28 18:27:07 +02:00
},
};
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
const { icon: Icon, color, bgColor, borderColor } = statusConfig[status];
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
return (
<div
className={`mb-4 flex items-center rounded-lg border p-4 ${bgColor} ${borderColor}`}
>
<div
className={`size-8 shrink-0 ${color} ${status === "processing" ? "animate-spin" : ""}`}
>
<Icon className="size-8" />
</div>
<div className="ml-3">
2025-10-10 16:18:43 +02:00
<h3 className={`font-medium text-sm ${color}`}>{title}</h3>
{message && <div className="mt-2 text-gray-700 text-sm">{message}</div>}
2025-08-28 18:27:07 +02:00
</div>
</div>
);
2025-08-04 17:45:44 +02:00
}