Files
portabase/src/components/wrappers/status-badge.tsx
T

33 lines
831 B
TypeScript
Raw Normal View History

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 = {
status: "pending" | "processing" | "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
case 'processing':
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:
throw Error
}
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
}