diff --git a/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.styles.js b/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.styles.ts similarity index 100% rename from src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.styles.js rename to src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.styles.ts diff --git a/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.jsx b/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.tsx similarity index 85% rename from src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.jsx rename to src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.tsx index 77fd32c1a..cad60e09c 100644 --- a/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.jsx +++ b/src/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.tsx @@ -9,9 +9,15 @@ import Typography from '@mui/material/Typography' import AppButton from '~/components/app-button/AppButton' import { styles } from '~/components/enhanced-table/enhanced-table-pagination/EnhancedTablePagination.styles' -import { ButtonVariantEnum } from '~/types' +import { ButtonVariantEnum, TablePaginationProps } from '~/types' -const EnhancedTablePagination = ({ pagination }) => { +interface EnhancedTablePaginationProps { + pagination: TablePaginationProps +} + +const EnhancedTablePagination = ({ + pagination +}: EnhancedTablePaginationProps) => { const { t } = useTranslation() const { @@ -26,7 +32,7 @@ const EnhancedTablePagination = ({ pagination }) => { handlePageSubmit } = pagination - const PaginationController = (currentPage, pageCount) => { + const PaginationController = (currentPage: number, pageCount: number) => { return ( { ) } - const getDisplayedRowsLabel = (from, to, count) => + const getDisplayedRowsLabel = (from: number, to: number, count: number) => `${from}-${to} ${t('table.of')} ${count}` return ( diff --git a/src/types/components/enhanced-table/enhancedTable.interface.ts b/src/types/components/enhanced-table/enhancedTable.interface.ts index 086b19797..526879ea1 100644 --- a/src/types/components/enhanced-table/enhancedTable.interface.ts +++ b/src/types/components/enhanced-table/enhancedTable.interface.ts @@ -48,3 +48,18 @@ export interface TableData { loading?: boolean getData?: () => void } + +export interface TablePaginationProps { + page: number + pageInput: number | string + rowsPerPage: number + pageCount: number + itemsCount: number + handleChangePage: ( + event: ChangeEvent | MouseEvent | null, + page: number + ) => void + handleChangeRowsPerPage: (e: ChangeEvent) => void + handleChangePageInput: (e: ChangeEvent) => void + handlePageSubmit: (maxPages: number) => void +}