2024-11-10 23:31:53 +01:00
|
|
|
import {Badge} from "@/components/ui/badge";
|
2024-11-11 14:56:33 +01:00
|
|
|
import {cn} from "@/lib/utils";
|
2024-11-10 23:31:53 +01:00
|
|
|
|
2024-11-11 14:56:33 +01:00
|
|
|
export type statusBadgeProps = {
|
2024-12-02 08:42:01 +01:00
|
|
|
status: "pending" | "ongoing" | "success" | "failed"
|
2024-11-10 23:31:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-11 14:56:33 +01:00
|
|
|
export const StatusBadge = ({status}: statusBadgeProps) => {
|
|
|
|
|
|
|
|
|
|
let style = "";
|
2024-11-10 23:31:53 +01:00
|
|
|
|
|
|
|
|
switch (status) {
|
2024-11-11 14:56:33 +01:00
|
|
|
case 'pending':
|
|
|
|
|
style = "text-yellow-500 border-yellow-500"
|
|
|
|
|
break
|
2024-12-02 08:42:01 +01:00
|
|
|
case 'ongoing':
|
2024-11-11 14:56:33 +01:00
|
|
|
style = "text-orange-500 border-orange-500"
|
|
|
|
|
break
|
2024-11-10 23:31:53 +01:00
|
|
|
case 'failed':
|
2024-11-11 14:56:33 +01:00
|
|
|
style = "text-red-500 border-red-500"
|
|
|
|
|
break
|
2024-11-10 23:31:53 +01:00
|
|
|
case 'success':
|
2024-11-11 14:56:33 +01:00
|
|
|
style = "text-green-500 border-green-500"
|
|
|
|
|
break
|
2024-11-10 23:31:53 +01:00
|
|
|
default:
|
2024-12-02 08:42:01 +01:00
|
|
|
style = "text-yellow-500 border-yellow-500"
|
2024-11-10 23:31:53 +01:00
|
|
|
}
|
2024-11-11 14:56:33 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="outline" className={cn("w-20 border-2 justify-center")}>{status}</Badge>
|
|
|
|
|
)
|
2024-11-10 23:31:53 +01:00
|
|
|
}
|