From 58102b806f65c18cfbade4112e4173a9d2975115 Mon Sep 17 00:00:00 2001 From: letnull19A Date: Sat, 7 Feb 2026 15:01:32 +0400 Subject: [PATCH 1/2] fix: fixed margin of table --- .../TableContainer/TableContainer.tsx | 65 ++++++++----------- .../library/src/modules/Table/constants.ts | 10 +-- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx b/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx index 21db80c..2eae7da 100644 --- a/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx +++ b/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx @@ -1,33 +1,32 @@ -import classNames from 'classnames' -import styles from './TableContainer.module.scss' -import { PropsWithChildren, useMemo } from 'react' -import { useGitContext } from 'context/GitContext' -import { placeholderCommits } from 'modules/Graph/strategies/Grid/hooks/usePlaceholderData/data' -import { ROW_HEIGHT } from 'constants/constants' -import { HEADER_ROW_HEIGHT, TABLE_MARGIN_TOP } from 'modules/Table/constants' -import { TableContainerProps } from 'modules/Table/components/TableContainer/types' +import classNames from "classnames"; +import styles from "./TableContainer.module.scss"; +import { PropsWithChildren, useMemo } from "react"; +import { useGitContext } from "context/GitContext"; +import { placeholderCommits } from "modules/Graph/strategies/Grid/hooks/usePlaceholderData/data"; +import { ROW_HEIGHT } from "constants/constants"; +import { HEADER_ROW_HEIGHT } from "modules/Table/constants"; +import { TableContainerProps } from "modules/Table/components/TableContainer/types"; export const TableContainer = ({ row, rowQuantity, children, className, - styleOverrides + styleOverrides, }: PropsWithChildren) => { - const { rowSpacing, showHeaders } = useGitContext() + const { rowSpacing, showHeaders } = useGitContext(); const gridTemplateRows = useMemo(() => { // If no commits are visible as we're showing // the placeholder data for the skeleton view, // then use that size, else just use the log data length. - const commitsVisible = rowQuantity > 0 - ? rowQuantity - : placeholderCommits.length + const commitsVisible = + rowQuantity > 0 ? rowQuantity : placeholderCommits.length; // If the table headers are turned off, then we simply // repeat the same row height for all rows. if (!showHeaders) { - return `repeat(${commitsVisible}, ${ROW_HEIGHT}px)` + return `repeat(${commitsVisible}, ${ROW_HEIGHT}px)`; } // With no row spacing, the header row height lines @@ -35,50 +34,40 @@ export const TableContainer = ({ // spacing is increased, we must subtract half of it // from the height of the first header row to counteract // the gap between the header and the first data row. - const headerRowHeight = HEADER_ROW_HEIGHT - (rowSpacing / 2) + const headerRowHeight = HEADER_ROW_HEIGHT - rowSpacing / 2; // All other rows (with data) get a fixed height. - const remainingRowsHeight = `repeat(${commitsVisible}, ${ROW_HEIGHT}px)` + const remainingRowsHeight = `repeat(${commitsVisible}, ${ROW_HEIGHT}px)`; - return `${headerRowHeight}px ${remainingRowsHeight}` - }, [rowQuantity, rowSpacing, showHeaders]) - - const marginTop = useMemo(() => { - if (showHeaders) { - return TABLE_MARGIN_TOP - } - - return (rowSpacing / 2) + TABLE_MARGIN_TOP - }, [rowSpacing, showHeaders]) + return `${headerRowHeight}px ${remainingRowsHeight}`; + }, [rowQuantity, rowSpacing, showHeaders]); if (row) { return (
{children}
- ) + ); } - + return (
{children}
- ) -} \ No newline at end of file + ); +}; diff --git a/packages/library/src/modules/Table/constants.ts b/packages/library/src/modules/Table/constants.ts index a215f3f..6ff64d0 100644 --- a/packages/library/src/modules/Table/constants.ts +++ b/packages/library/src/modules/Table/constants.ts @@ -4,12 +4,4 @@ * data row lines up with the first row * on the graph. Assuming 0 row spacing. */ -export const HEADER_ROW_HEIGHT = 47 - -/** - * The number of pixels of margin at the - * top of the table element that offsets - * it enough to line-up correctly with - * the graph - */ -export const TABLE_MARGIN_TOP = 12 \ No newline at end of file +export const HEADER_ROW_HEIGHT = 47; From 3037e5869151f19ed49e766ccde7c7dae5c662cd Mon Sep 17 00:00:00 2001 From: letnull19A Date: Sat, 7 Feb 2026 17:47:56 +0400 Subject: [PATCH 2/2] refactor: check problems by linter --- .../TableContainer/TableContainer.tsx | 36 +++++++++---------- .../library/src/modules/Table/constants.ts | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx b/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx index 2eae7da..a0c00ce 100644 --- a/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx +++ b/packages/library/src/modules/Table/components/TableContainer/TableContainer.tsx @@ -1,11 +1,11 @@ -import classNames from "classnames"; -import styles from "./TableContainer.module.scss"; -import { PropsWithChildren, useMemo } from "react"; -import { useGitContext } from "context/GitContext"; -import { placeholderCommits } from "modules/Graph/strategies/Grid/hooks/usePlaceholderData/data"; -import { ROW_HEIGHT } from "constants/constants"; -import { HEADER_ROW_HEIGHT } from "modules/Table/constants"; -import { TableContainerProps } from "modules/Table/components/TableContainer/types"; +import classNames from 'classnames' +import styles from './TableContainer.module.scss' +import { PropsWithChildren, useMemo } from 'react' +import { useGitContext } from 'context/GitContext' +import { placeholderCommits } from 'modules/Graph/strategies/Grid/hooks/usePlaceholderData/data' +import { ROW_HEIGHT } from 'constants/constants' +import { HEADER_ROW_HEIGHT } from 'modules/Table/constants' +import { TableContainerProps } from 'modules/Table/components/TableContainer/types' export const TableContainer = ({ row, @@ -14,19 +14,19 @@ export const TableContainer = ({ className, styleOverrides, }: PropsWithChildren) => { - const { rowSpacing, showHeaders } = useGitContext(); + const { rowSpacing, showHeaders } = useGitContext() const gridTemplateRows = useMemo(() => { // If no commits are visible as we're showing // the placeholder data for the skeleton view, // then use that size, else just use the log data length. const commitsVisible = - rowQuantity > 0 ? rowQuantity : placeholderCommits.length; + rowQuantity > 0 ? rowQuantity : placeholderCommits.length // If the table headers are turned off, then we simply // repeat the same row height for all rows. if (!showHeaders) { - return `repeat(${commitsVisible}, ${ROW_HEIGHT}px)`; + return `repeat(${commitsVisible}, ${ROW_HEIGHT}px)` } // With no row spacing, the header row height lines @@ -34,13 +34,13 @@ export const TableContainer = ({ // spacing is increased, we must subtract half of it // from the height of the first header row to counteract // the gap between the header and the first data row. - const headerRowHeight = HEADER_ROW_HEIGHT - rowSpacing / 2; + const headerRowHeight = HEADER_ROW_HEIGHT - rowSpacing / 2 // All other rows (with data) get a fixed height. - const remainingRowsHeight = `repeat(${commitsVisible}, ${ROW_HEIGHT}px)`; + const remainingRowsHeight = `repeat(${commitsVisible}, ${ROW_HEIGHT}px)` - return `${headerRowHeight}px ${remainingRowsHeight}`; - }, [rowQuantity, rowSpacing, showHeaders]); + return `${headerRowHeight}px ${remainingRowsHeight}` + }, [rowQuantity, rowSpacing, showHeaders]) if (row) { return ( @@ -53,7 +53,7 @@ export const TableContainer = ({ > {children} - ); + ) } return ( @@ -69,5 +69,5 @@ export const TableContainer = ({ > {children} - ); -}; + ) +} diff --git a/packages/library/src/modules/Table/constants.ts b/packages/library/src/modules/Table/constants.ts index 6ff64d0..855812e 100644 --- a/packages/library/src/modules/Table/constants.ts +++ b/packages/library/src/modules/Table/constants.ts @@ -4,4 +4,4 @@ * data row lines up with the first row * on the graph. Assuming 0 row spacing. */ -export const HEADER_ROW_HEIGHT = 47; +export const HEADER_ROW_HEIGHT = 47