Add sortable table with refetchable
Signed-off-by: Bryan Frimin <bryan@getprobo.com> Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
c2a69b5428
commit
1448d37d55
@@ -19,17 +19,15 @@
|
||||
"@radix-ui/react-portal": "^1.1.9",
|
||||
"@radix-ui/react-scroll-area": "^1.2.9",
|
||||
"@tailwindcss/vite": "^4.1.7",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"tailwind-merge": "^3.3.0",
|
||||
"tailwind-variants": "^1.0.0",
|
||||
"tailwindcss": "^4.1.7",
|
||||
"tw-animate-css": "^1.3.0",
|
||||
"zustand": "^5.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"@chromatic-com/storybook": "^3.2.6",
|
||||
"@eslint/js": "^9.25.0",
|
||||
"@probo/prettier": "1.0.0",
|
||||
@@ -59,7 +57,9 @@
|
||||
"vitest": "^3.1.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react-router": "^7.6.0"
|
||||
"react-router": "^7.6.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
||||
@@ -12,10 +12,10 @@ type Story = StoryObj<typeof SeverityBadge>;
|
||||
export const Default: Story = {
|
||||
render: () => (
|
||||
<div className="space-y-2">
|
||||
<SeverityBadge severity={75} />
|
||||
<SeverityBadge severity={50} />
|
||||
<SeverityBadge severity={25} />
|
||||
<SeverityBadge severity={0} />
|
||||
<SeverityBadge score={75} />
|
||||
<SeverityBadge score={50} />
|
||||
<SeverityBadge score={25} />
|
||||
<SeverityBadge score={0} />
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
@@ -9,22 +9,22 @@ const badgeVariant = (score: number) => {
|
||||
if (score >= 15) {
|
||||
return "danger";
|
||||
}
|
||||
if (score >= 5) {
|
||||
if (score > 6) {
|
||||
return "warning";
|
||||
}
|
||||
return "neutral";
|
||||
return "success";
|
||||
};
|
||||
|
||||
export function SeverityBadge({ score }: Props) {
|
||||
const { __ } = useTranslate();
|
||||
const label = () => {
|
||||
if (score >= 15) {
|
||||
return __("Critical");
|
||||
}
|
||||
if (score >= 5) {
|
||||
return __("High");
|
||||
}
|
||||
return __("Negligible");
|
||||
if (score > 6) {
|
||||
return __("Medium");
|
||||
}
|
||||
return __("Low");
|
||||
};
|
||||
return <Badge variant={badgeVariant(score)}>{label()}</Badge>;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ const getLevel = (score: number): 0 | 1 | 2 => {
|
||||
if (score >= 15) {
|
||||
return 2;
|
||||
}
|
||||
if (score > 4) {
|
||||
if (score > 6) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user