-
Notifications
You must be signed in to change notification settings - Fork 947
/
Copy pathStatusBadge.tsx
34 lines (30 loc) · 1008 Bytes
/
StatusBadge.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Status } from "@/api/types";
import { Badge } from "./ui/badge";
import { cn } from "@/util/utils";
type Props = {
status: Status;
};
function StatusBadge({ status }: Props) {
const statusText = status === "timed_out" ? "timed out" : status;
return (
<Badge
className={cn("flex h-7 w-24 justify-center", {
"bg-green-900 text-green-50 hover:bg-green-900/80":
status === Status.Completed,
"bg-orange-900 text-orange-50 hover:bg-orange-900/80":
status === Status.Terminated,
"bg-gray-900 text-gray-50 hover:bg-gray-900/80":
status === Status.Created,
"bg-red-900 text-red-50 hover:bg-red-900/80":
status === Status.Failed ||
status === Status.Canceled ||
status === Status.TimedOut,
"bg-yellow-900 text-yellow-50 hover:bg-yellow-900/80":
status === Status.Running || status === Status.Queued,
})}
>
{statusText}
</Badge>
);
}
export { StatusBadge };