-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: phix <[email protected]> Co-authored-by: phix <[email protected]> Co-authored-by: Willy Lulciuc <[email protected]>
- Loading branch information
1 parent
8bfea3f
commit bd07b9b
Showing
4 changed files
with
90 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2018-2023 contributors to the Marquez project | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Box } from '@mui/material' | ||
import { ChevronLeftRounded, ChevronRightRounded } from '@mui/icons-material' | ||
import { theme } from '../../helpers/theme' | ||
import IconButton from '@mui/material/IconButton' | ||
import MQTooltip from '../core/tooltip/MQTooltip' | ||
import MqText from '../core/text/MqText' | ||
import React, { FunctionComponent } from 'react' | ||
|
||
const i18next = require('i18next') | ||
|
||
interface Props { | ||
pageSize: number | ||
currentPage: number | ||
totalCount: number | ||
incrementPage: (page: number) => void | ||
decrementPage: (page: number) => void | ||
} | ||
|
||
const MqPaging: FunctionComponent<Props> = (props) => { | ||
const { pageSize, currentPage, incrementPage, decrementPage, totalCount } = props | ||
return ( | ||
<Box display={'flex'} justifyContent={'flex-end'} alignItems={'center'} mb={2}> | ||
<MqText subdued> | ||
<> | ||
{pageSize * currentPage + 1} - {Math.min(pageSize * (currentPage + 1), totalCount)} of{' '} | ||
{totalCount} | ||
</> | ||
</MqText> | ||
<MQTooltip title={i18next.t('events_route.previous_page')}> | ||
<span> | ||
<IconButton | ||
sx={{ | ||
marginLeft: theme.spacing(2), | ||
}} | ||
color='primary' | ||
disabled={currentPage === 0} | ||
onClick={() => decrementPage(1)} | ||
size='small' | ||
> | ||
<ChevronLeftRounded /> | ||
</IconButton> | ||
</span> | ||
</MQTooltip> | ||
<MQTooltip title={i18next.t('events_route.next_page')}> | ||
<span> | ||
<IconButton | ||
color='primary' | ||
onClick={() => incrementPage(1)} | ||
size='small' | ||
disabled={currentPage === Math.ceil(totalCount / pageSize) - 1} | ||
> | ||
<ChevronRightRounded /> | ||
</IconButton> | ||
</span> | ||
</MQTooltip> | ||
</Box> | ||
) | ||
} | ||
|
||
export default MqPaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters