Skip to content

Commit 225856e

Browse files
fix(components): [GenericTable] Delimit regular variant height MAASENG-5415 (#186)
* fix(components): [GenericTable] removed GroupRowActions.tsx * fix(components): [GenericTable] keep auto sizing for regular variant even if it overflows * fix(components): [GenericTable] fixed stories, added chevrons * fix(components): [GenericTable] linting
1 parent 2dbf38a commit 225856e

File tree

6 files changed

+12
-77
lines changed

6 files changed

+12
-77
lines changed

src/lib/components/GenericTable/GenericTable.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from "@tanstack/react-table";
1313

1414
import { GenericTable } from "@/lib/components/GenericTable/GenericTable";
15-
import { GroupRowActions } from "@/lib/components/GenericTable/GroupRowActions";
1615

1716
type Machine = {
1817
id: number;
@@ -438,7 +437,6 @@ export const ConditionallySelectable: Story = {
438437
accessorKey: "id",
439438
header: "Actions",
440439
cell: ({ row }: { row: Row<Machine> }) => {
441-
if (row.getIsGrouped()) return <GroupRowActions row={row} />;
442440
return (
443441
<div className="actions-cell">
444442
<Tooltip
@@ -501,6 +499,7 @@ export const Grouped: Story = {
501499
},
502500
filterHeaders: (header: Header<Machine, unknown>): boolean =>
503501
header.column.id !== "status",
502+
showChevron: true,
504503
},
505504
};
506505

@@ -581,6 +580,7 @@ export const GroupedSelectable: Story = {
581580
},
582581
filterHeaders: (header: Header<Machine, unknown>): boolean =>
583582
header.column.id !== "status",
583+
showChevron: true,
584584
},
585585
};
586586

@@ -633,7 +633,6 @@ export const GroupedNested: Story = {
633633
accessorKey: "id",
634634
header: "Actions",
635635
cell: ({ row }: { row: Row<Machine> }) => {
636-
if (row.getIsGrouped()) return <GroupRowActions row={row} />;
637636
return (
638637
<div className="actions-cell">
639638
<Tooltip

src/lib/components/GenericTable/GenericTable.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,11 @@ export const GenericTable = <T extends { id: number | string }>({
256256
const isExpanded = row.getIsExpanded();
257257
if (row.getIsGrouped()) {
258258
return (
259-
<Tooltip message={isExpanded ? "Collapse" : "Expand"} position="btm-right">
260-
<Icon
261-
name={
262-
isExpanded ? ICONS.chevronUp : ICONS.chevronDown
263-
}
264-
/>
259+
<Tooltip
260+
message={isExpanded ? "Collapse" : "Expand"}
261+
position="btm-right"
262+
>
263+
<Icon name={isExpanded ? ICONS.chevronUp : ICONS.chevronDown} />
265264
</Tooltip>
266265
);
267266
}
@@ -365,7 +364,11 @@ export const GenericTable = <T extends { id: number | string }>({
365364
const willNeedScrolling = contentHeight > availableHeight;
366365

367366
setNeedsScrolling(willNeedScrolling);
368-
setMaxHeight(willNeedScrolling ? `${availableHeight}px` : "auto");
367+
setMaxHeight(
368+
variant === "full-height" && willNeedScrolling
369+
? `${availableHeight}px`
370+
: "auto",
371+
);
369372
};
370373

371374
updateHeight();

src/lib/components/GenericTable/GroupRowActions/GroupRowActions.test.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/lib/components/GenericTable/GroupRowActions/GroupRowActions.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/lib/components/GenericTable/GroupRowActions/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./GenericTable";
2-
export * from "./GroupRowActions/GroupRowActions";

0 commit comments

Comments
 (0)