feat: Categories retrieve + list API (#7009)

This commit is contained in:
Oli Juhl
2024-04-08 19:26:34 +02:00
committed by GitHub
parent db2f0ef53f
commit 6cc9a5e469
41 changed files with 1176 additions and 35 deletions

View File

@@ -182,6 +182,7 @@ export const DataTableRoot = <TData,>({
{table.getRowModel().rows.map((row) => {
const to = navigateTo ? navigateTo(row) : undefined
const isRowDisabled = hasSelect && !row.getCanSelect()
return (
<Table.Row
key={row.id}
@@ -192,7 +193,8 @@ export const DataTableRoot = <TData,>({
"cursor-pointer": !!to,
"bg-ui-bg-highlight hover:bg-ui-bg-highlight-hover":
row.getIsSelected(),
"bg-ui-bg-subtle hover:bg-ui-bg-subtle": isRowDisabled,
"bg-ui-bg-disabled hover:bg-ui-bg-disabled":
isRowDisabled,
}
)}
onClick={to ? () => navigate(to) : undefined}
@@ -211,6 +213,15 @@ export const DataTableRoot = <TData,>({
const isStickyCell = isSelectCell || isFirstCell
/**
* If the table has nested rows, we need to offset the cell padding
* to indicate the depth of the row.
*/
const depthOffset =
row.depth > 0 && isFirstCell
? row.depth * 14 + 24
: undefined
return (
<Table.Cell
key={cell.id}
@@ -221,9 +232,14 @@ export const DataTableRoot = <TData,>({
isStickyCell && hasSelect && !isSelectCell,
"after:bg-ui-border-base":
showStickyBorder && isStickyCell && !isSelectCell,
"bg-ui-bg-subtle hover:bg-ui-bg-subtle":
"!bg-ui-bg-disabled !hover:bg-ui-bg-disabled":
isRowDisabled,
})}
style={{
paddingLeft: depthOffset
? `${depthOffset}px`
: undefined,
}}
>
{flexRender(
cell.column.columnDef.cell,