chore: add new component for finding status and add sorting to the findings table

This commit is contained in:
Pablo Lara committed 2024-11-19 13:05:22 +01:00
1 parent e84fd1fd65
commit 73c5764495
5 files changed
+85 -35

No files matched your search

+1
View File
@@ -4,4 +4,5 @@ export * from "./data-table-filter-custom";
export * from "./data-table-pagination";
export * from "./severity-badge";
export * from "./status-badge";
export * from "./status-finding-badge";
export * from "./table";
+2 -1
View File
@@ -37,7 +37,8 @@ export const SeverityBadge = ({ severity }: { severity: Severity }) => {
return (
<Chip
className={clsx("gap-1 border-none capitalize text-default-600", {
"bg-rose-700/20": severity === "critical",
"bg-system-severity-critical text-white dark:text-white":
severity === "critical",
})}
size="sm"
variant="flat"
@@ -0,0 +1,37 @@
import { Chip } from "@nextui-org/react";
import React from "react";
export type FindingStatus = "FAIL" | "PASS" | "MANUAL" | "MUTED";
const statusColorMap: Record<
FindingStatus,
"danger" | "warning" | "success" | "default"
> = {
FAIL: "danger",
PASS: "success",
MANUAL: "warning",
MUTED: "default",
};
export const StatusFindingBadge = ({
status,
size = "sm",
...props
}: {
status: FindingStatus;
size?: "sm" | "md" | "lg";
}) => {
const color = statusColorMap[status];
return (
<Chip
className="gap-1 border-none px-2 py-4 capitalize text-default-600"
size={size}
variant="flat"
color={color}
{...props}
>
{status}
</Chip>
);
};