fix(ui): повысить контраст заполненных таблиц BGP и OSPF
This commit is contained in:
1 parent
d91cc77cda
commit
8b60ab040a
16 files changed
+1291
-101
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
useTable,
|
||||
} from "@tanstack/react-table"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Badge } from "@/components/reui/badge"
|
||||
import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell"
|
||||
import {
|
||||
DATA_GRID_CELL_PAD,
|
||||
@@ -31,12 +32,10 @@ export interface OspfRouteRow {
|
||||
area: string
|
||||
}
|
||||
|
||||
function routeTypeClass(type: OspfRouteRow["type"]) {
|
||||
if (type === "Unknown") return "bg-muted text-muted-foreground border-border"
|
||||
if (type === "O") return "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/25"
|
||||
if (type === "O IA") return "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/25"
|
||||
if (type === "O E1") return "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/25"
|
||||
return "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/25"
|
||||
function OspfRouteTypeBadge({ type, count }: { type: OspfRouteRow["type"]; count?: number }) {
|
||||
return <Badge variant="invert-light" size="sm">
|
||||
{type === "Unknown" ? "Тип неизвестен" : type}{count === undefined ? "" : ": " + count}
|
||||
</Badge>
|
||||
}
|
||||
|
||||
interface OspfRoutesDataGridProps {
|
||||
@@ -67,14 +66,7 @@ function OspfRoutesDataGrid({ routes, emptyTitle }: OspfRoutesDataGridProps) {
|
||||
accessorKey: "type",
|
||||
header: ({ column }) => <DataGridSortHeader column={column} title="Тип" />,
|
||||
cell: ({ row }) => (
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center rounded border px-1.5 py-0.5 text-[11px] font-medium",
|
||||
routeTypeClass(row.original.type),
|
||||
)}
|
||||
>
|
||||
{row.original.type === "Unknown" ? "Тип неизвестен" : row.original.type}
|
||||
</span>
|
||||
<OspfRouteTypeBadge type={row.original.type} />
|
||||
),
|
||||
meta: { headerTitle: "Тип", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD },
|
||||
},
|
||||
@@ -189,4 +181,4 @@ function OspfRoutesDataGrid({ routes, emptyTitle }: OspfRoutesDataGridProps) {
|
||||
)
|
||||
}
|
||||
|
||||
export { OspfRoutesDataGrid, type OspfRoutesDataGridProps, routeTypeClass }
|
||||
export { OspfRoutesDataGrid, type OspfRoutesDataGridProps, OspfRouteTypeBadge }
|
||||
Reference in new issue
Block a user