mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-08 20:33:41 +00:00
* feat(findings): Severity and Status badge WIP * feat(findings): Status and Severity badge changes * Fix font color for dark mode
45 lines
983 B
TypeScript
45 lines
983 B
TypeScript
import { Chip } from "@nextui-org/react";
|
|
import React from "react";
|
|
|
|
type Status =
|
|
| "completed"
|
|
| "pending"
|
|
| "cancelled"
|
|
| "fail"
|
|
| "success"
|
|
| "muted";
|
|
|
|
const statusColorMap: Record<
|
|
Status,
|
|
| "text-white bg-green-600"
|
|
| "bg-yellow-200"
|
|
| "text-white bg-red-600"
|
|
| "bg-gray-300"
|
|
> = {
|
|
completed: "text-white bg-green-600",
|
|
pending: "bg-yellow-200",
|
|
cancelled: "text-white bg-red-600",
|
|
fail: "text-white bg-red-600",
|
|
success: "text-white bg-green-600",
|
|
muted: "bg-gray-300",
|
|
};
|
|
|
|
const getStatusColor: (status: Status) => string = (status) =>
|
|
// eslint-disable-next-line security/detect-object-injection
|
|
statusColorMap[status];
|
|
|
|
export const StatusBadge = ({ status }: { status: Status }) => {
|
|
return (
|
|
<Chip
|
|
classNames={{
|
|
base: `capitalize border-none gap-1 text-gray-600 ${getStatusColor(status)}`,
|
|
content: "font-semibold",
|
|
}}
|
|
size="sm"
|
|
variant="solid"
|
|
>
|
|
{status}
|
|
</Chip>
|
|
);
|
|
};
|