From 05a1c0c5887348288ad472277930e3cb71f72306 Mon Sep 17 00:00:00 2001 From: Mukul Bansal Date: Fri, 3 Jan 2025 16:52:50 +0530 Subject: [PATCH] fix: fix table row id issue affects: @medly-components/core --- .../core/src/components/Table/Body/Body.tsx | 8 ++--- .../src/components/Table/Body/Row/Row.tsx | 3 +- .../Body/__snapshots__/Body.test.tsx.snap | 32 +------------------ .../Table/__snapshots__/Table.test.tsx.snap | 30 ++++++++--------- 4 files changed, 22 insertions(+), 51 deletions(-) diff --git a/packages/core/src/components/Table/Body/Body.tsx b/packages/core/src/components/Table/Body/Body.tsx index c3493d904..a10bb09f8 100644 --- a/packages/core/src/components/Table/Body/Body.tsx +++ b/packages/core/src/components/Table/Body/Body.tsx @@ -68,12 +68,11 @@ const Body: FC = memo(props => { )} {data.map((row, index) => { - const identifier = (groupBy ? row[groupBy] : row[rowIdentifier]) || index, - uniqueId = isNaN(Number(identifier)) ? index : identifier; + const uniqueId = (groupBy ? row[groupBy] : row[rowIdentifier]) || index; return groupBy ? ( = memo(props => { ) : ( = memo(props => { const [isRowHovered, setIsRowHovered] = useState(false), { id, + tabIndex, data, isNavigated = false, isRowExpandedFromKeyboard, @@ -136,7 +137,7 @@ export const Row: FC = memo(props => { * { - background-color: #D7E3F6; - color: #13181D; -} - -.c7:nth-child(even), -.c7:nth-child(even) > * { - background-color: #D7E3F6; - color: #13181D; -} -
diff --git a/packages/core/src/components/Table/__snapshots__/Table.test.tsx.snap b/packages/core/src/components/Table/__snapshots__/Table.test.tsx.snap index eb1938d89..bbe1a7aa1 100644 --- a/packages/core/src/components/Table/__snapshots__/Table.test.tsx.snap +++ b/packages/core/src/components/Table/__snapshots__/Table.test.tsx.snap @@ -1007,7 +1007,7 @@ exports[`Table component pagination should call onPageChange prop on click on an