From a75ddfd8a62f6c6a0c8ded2f1efa72c15d4cba11 Mon Sep 17 00:00:00 2001 From: mufazalov Date: Fri, 27 Oct 2023 14:04:51 +0300 Subject: [PATCH] fix: review changes --- .../ProgressViewer/ProgressViewer.scss | 1 + src/components/VirtualTable/TableHead.tsx | 38 +++++++------------ src/components/VirtualTable/TableRow.tsx | 16 +------- src/components/VirtualTable/VirtualTable.scss | 5 ++- src/components/VirtualTable/constants.ts | 2 + .../VirtualTable/useIntersectionObserver.ts | 3 +- src/components/VirtualTable/utils.ts | 7 +--- 7 files changed, 26 insertions(+), 46 deletions(-) diff --git a/src/components/ProgressViewer/ProgressViewer.scss b/src/components/ProgressViewer/ProgressViewer.scss index 7a94f84b1..6f7b77288 100644 --- a/src/components/ProgressViewer/ProgressViewer.scss +++ b/src/components/ProgressViewer/ProgressViewer.scss @@ -1,5 +1,6 @@ .progress-viewer { position: relative; + z-index: 0; display: flex; overflow: hidden; diff --git a/src/components/VirtualTable/TableHead.tsx b/src/components/VirtualTable/TableHead.tsx index 3b69e8989..a75d5b197 100644 --- a/src/components/VirtualTable/TableHead.tsx +++ b/src/components/VirtualTable/TableHead.tsx @@ -4,28 +4,19 @@ import type {Column, OnSort, SortOrderType, SortParams} from './types'; import {ASCENDING, DEFAULT_SORT_ORDER, DEFAULT_TABLE_ROW_HEIGHT, DESCENDING} from './constants'; import {b} from './shared'; -// Icons similar to original DataTable icons to keep the same tables across diferent pages and tabs -const ICON_ASC = ( - - - -); -const ICON_DESC = ( - - - -); - -function getSortIcon(order?: SortOrderType) { - switch (order) { - case ASCENDING: - return ICON_ASC; - case DESCENDING: - return ICON_DESC; - default: - return false; - } -} +// Icon similar to original DataTable icons to keep the same tables across diferent pages and tabs +const SortIcon = ({order}: {order?: SortOrderType}) => { + return ( + + + + ); +}; interface ColumnSortIconProps { sortOrder?: SortOrderType; @@ -37,7 +28,7 @@ const ColumnSortIcon = ({sortOrder, sortable, defaultSortOrder}: ColumnSortIconP if (sortable) { return ( - {getSortIcon(sortOrder || defaultSortOrder)} + ); } else { @@ -117,7 +108,6 @@ export const TableHead = ({ column.className, )} style={{ - width: `${column.width}px`, height: `${rowHeight}px`, }} onClick={() => { diff --git a/src/components/VirtualTable/TableRow.tsx b/src/components/VirtualTable/TableRow.tsx index 8ecc79e6b..35e8abaea 100644 --- a/src/components/VirtualTable/TableRow.tsx +++ b/src/components/VirtualTable/TableRow.tsx @@ -8,24 +8,14 @@ import {b} from './shared'; interface TableCellProps { height: number; - width?: number; align?: AlignType; children: ReactNode; className?: string; } -const TableRowCell = ({ - children, - width, - className, - height, - align = DEFAULT_ALIGN, -}: TableCellProps) => { +const TableRowCell = ({children, className, height, align = DEFAULT_ALIGN}: TableCellProps) => { return ( - + {children} ); @@ -44,7 +34,6 @@ export const LoadingTableRow = ({index, columns, height}: LoadingTableRowPro return ( ({row, index, columns, getRowClassName, height}: Tab return ( { diff --git a/src/components/VirtualTable/utils.ts b/src/components/VirtualTable/utils.ts index 6a9adccda..ffa1fa018 100644 --- a/src/components/VirtualTable/utils.ts +++ b/src/components/VirtualTable/utils.ts @@ -1,8 +1,3 @@ export const getArray = (arrayLength: number) => { - const rows = []; - - for (let i = 0; i < arrayLength; i++) { - rows.push(i); - } - return rows; + return [...Array(arrayLength).keys()]; };