From 509d3a574efb04d531606a6c073a7833f42be891 Mon Sep 17 00:00:00 2001 From: MykhailoPopovych <125293578+Mike-Popovych@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:56:15 +0300 Subject: [PATCH] rewrote EnhancedTableHeaderCell to tsx format (#2156) --- ....styles.js => EnhancedTableHeaderCell.styles.ts} | 0 ...leHeaderCell.jsx => EnhancedTableHeaderCell.tsx} | 13 +++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) rename src/components/enhanced-table/enhanced-table-header-cell/{EnhancedTableHeaderCell.styles.js => EnhancedTableHeaderCell.styles.ts} (100%) rename src/components/enhanced-table/enhanced-table-header-cell/{EnhancedTableHeaderCell.jsx => EnhancedTableHeaderCell.tsx} (73%) diff --git a/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.styles.js b/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.styles.ts similarity index 100% rename from src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.styles.js rename to src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.styles.ts diff --git a/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.jsx b/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.tsx similarity index 73% rename from src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.jsx rename to src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.tsx index fb461eacf..82bdab05d 100644 --- a/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.jsx +++ b/src/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.tsx @@ -4,13 +4,22 @@ import TableCell from '@mui/material/TableCell' import TableSortLabel from '@mui/material/TableSortLabel' import { styles } from '~/components/enhanced-table/enhanced-table-header-cell/EnhancedTableHeaderCell.styles' +import { TableColumn, TableItem, TableSort } from '~/types' -const EnhancedTableHeaderCell = ({ column, sort }) => { +export interface EnhancedTableHeaderCellProps { + column: TableColumn + sort: TableSort +} + +const EnhancedTableHeaderCell = ({ + column, + sort +}: EnhancedTableHeaderCellProps) => { const { t } = useTranslation() const { sort: sortParams, onRequestSort } = sort const createSortHandler = () => { - onRequestSort(column.field) + onRequestSort(column.field ?? '') } return (