Skip to content

Commit

Permalink
Rewrite EnhancedTablePagination to tsx (#2159)
Browse files Browse the repository at this point in the history
* rewrote EnhancedTablePagination to tsx

* fixed currentpage to currentPage
  • Loading branch information
Mike-Popovych authored and ipasic-softserve committed Aug 1, 2024
1 parent d5c6586 commit fee7171
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -26,7 +32,7 @@ const EnhancedTablePagination = ({ pagination }) => {
handlePageSubmit
} = pagination

const PaginationController = (currentPage, pageCount) => {
const PaginationController = (currentPage: number, pageCount: number) => {
return (
<Box
sx={{
Expand All @@ -42,7 +48,7 @@ const EnhancedTablePagination = ({ pagination }) => {
)
}

const getDisplayedRowsLabel = (from, to, count) =>
const getDisplayedRowsLabel = (from: number, to: number, count: number) =>
`${from}-${to} ${t('table.of')} ${count}`

return (
Expand Down
15 changes: 15 additions & 0 deletions src/types/components/enhanced-table/enhancedTable.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,18 @@ export interface TableData<I> {
loading?: boolean
getData?: () => void
}

export interface TablePaginationProps {
page: number
pageInput: number | string
rowsPerPage: number
pageCount: number
itemsCount: number
handleChangePage: (
event: ChangeEvent<unknown> | MouseEvent | null,
page: number
) => void
handleChangeRowsPerPage: (e: ChangeEvent<HTMLInputElement>) => void
handleChangePageInput: (e: ChangeEvent<HTMLInputElement>) => void
handlePageSubmit: (maxPages: number) => void
}

0 comments on commit fee7171

Please sign in to comment.