From 9c9fd59cd668458f23b76b017af3ae87780d2ab2 Mon Sep 17 00:00:00 2001 From: Mike-Popovych Date: Tue, 23 Jul 2024 19:17:40 +0300 Subject: [PATCH] rewrote EnhancedTableHeaderCell to tsx format --- ....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 fb461eacff..82bdab05d1 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 (