Skip to content

Commit 48c6bdc

Browse files
committed
fix: better scrolling
1 parent 5880f26 commit 48c6bdc

File tree

8 files changed

+24
-9
lines changed

8 files changed

+24
-9
lines changed

src/components/PaginatedTable/useTableScroll.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const useTableScroll = ({
2727

2828
// Handle table scrolling function
2929
const handleTableScroll = React.useCallback(() => {
30+
console.log('teteteteeetete');
3031
if (tableContainerRef.current && scrollContainerRef.current) {
3132
// Get the sticky top offset value
3233
const stickyTopOffset = getStickyTopOffset();

src/components/TableWithControlsLayout/TableWithControlsLayout.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
box-sizing: border-box;
99
min-width: 100%;
1010

11+
&_fullHeight {
12+
min-height: calc(100vh - var(--data-table-sticky-top-offset));
13+
}
14+
1115
&__controls-wrapper {
1216
z-index: 3;
1317

@@ -30,6 +34,10 @@
3034
&__table {
3135
position: relative;
3236
z-index: 2;
37+
38+
&_fullHeight {
39+
min-height: calc(100vh - var(--data-table-sticky-top-offset));
40+
}
3341
}
3442

3543
.ydb-paginated-table__head {

src/components/TableWithControlsLayout/TableWithControlsLayout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const b = cn('ydb-table-with-controls-layout');
1010
interface TableWithControlsLayoutItemProps {
1111
children: React.ReactNode;
1212
className?: string;
13+
fullHeight?: boolean;
1314
}
1415

1516
interface TableProps extends TableWithControlsLayoutItemProps {
@@ -19,8 +20,9 @@ interface TableProps extends TableWithControlsLayoutItemProps {
1920
export const TableWithControlsLayout = ({
2021
children,
2122
className,
23+
fullHeight,
2224
}: TableWithControlsLayoutItemProps) => {
23-
return <div className={b(null, className)}>{children}</div>;
25+
return <div className={b({fullHeight}, className)}>{children}</div>;
2426
};
2527

2628
TableWithControlsLayout.Controls = function TableControls({
@@ -35,15 +37,15 @@ TableWithControlsLayout.Controls = function TableControls({
3537
};
3638

3739
TableWithControlsLayout.Table = React.forwardRef<HTMLDivElement, TableProps>(function Table(
38-
{children, loading, className},
40+
{children, loading, className, fullHeight},
3941
ref,
4042
) {
4143
if (loading) {
4244
return <TableSkeleton className={b('loader')} />;
4345
}
4446

4547
return (
46-
<div ref={ref} className={b('table', className)}>
48+
<div ref={ref} className={b('table', {fullHeight}, className)}>
4749
{children}
4850
</div>
4951
);

src/containers/Cluster/Cluster.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@
6161
.ydb-table-with-controls-layout__controls-wrapper {
6262
top: 40px;
6363
}
64+
65+
.ydb-table-with-controls-layout {
66+
--data-table-sticky-top-offset: 102px;
67+
}
6468
}

src/containers/Nodes/Nodes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function NodesComponent({
181181

182182
return (
183183
<PaginatedTableProvider>
184-
<TableWithControlsLayout>
184+
<TableWithControlsLayout fullHeight>
185185
<TableWithControlsLayout.Controls>
186186
<NodesControlsWithTableState
187187
withGroupBySelect={viewerNodesHandlerHasGrouping}

src/containers/Storage/PaginatedStorageGroups.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function StorageGroupsComponent({
166166

167167
return (
168168
<PaginatedTableProvider>
169-
<TableWithControlsLayout>
169+
<TableWithControlsLayout fullHeight>
170170
<TableWithControlsLayout.Controls>
171171
<StorageGroupsControlsWithTableState
172172
withTypeSelector
@@ -279,7 +279,7 @@ function GroupedStorageGroupsComponent({
279279
};
280280

281281
return (
282-
<TableWithControlsLayout>
282+
<TableWithControlsLayout fullHeight>
283283
<TableWithControlsLayout.Controls>
284284
<StorageGroupsControlsWithTableState
285285
withTypeSelector

src/containers/Storage/PaginatedStorageNodes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function StorageNodesComponent({
177177

178178
return (
179179
<PaginatedTableProvider>
180-
<TableWithControlsLayout>
180+
<TableWithControlsLayout fullHeight>
181181
<TableWithControlsLayout.Controls>
182182
<StorageNodesControlsWithTableState
183183
withTypeSelector
@@ -290,7 +290,7 @@ function GroupedStorageNodesComponent({
290290
};
291291

292292
return (
293-
<TableWithControlsLayout>
293+
<TableWithControlsLayout fullHeight>
294294
<TableWithControlsLayout.Controls>
295295
<StorageNodesControlsWithTableState
296296
withTypeSelector

src/containers/Tablets/TabletsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export function TabletsTable({database, tablets, loading, error}: TabletsTablePr
189189
};
190190

191191
return (
192-
<TableWithControlsLayout>
192+
<TableWithControlsLayout fullHeight>
193193
<TableWithControlsLayout.Controls>
194194
<Search
195195
placeholder={i18n('controls.search-placeholder')}

0 commit comments

Comments
 (0)