-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathPaginationControls.js
More file actions
38 lines (35 loc) · 1.03 KB
/
PaginationControls.js
File metadata and controls
38 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Pagination } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
export const PaginationControls = ({ page, pager, onPageChange }) => (
<Pagination
page={page}
pageCount={pager.pageCount}
pageSize={pager.pageSize}
total={pager.total}
onPageChange={onPageChange}
onPageSizeChange={Function.prototype}
hidePageSizeSelect
pageSummaryText={({
firstItem: firstItemIndex,
lastItem: lastItemIndex,
total: totalNumberOfItems,
}) =>
i18n.t(
'{{firstItemIndex}}-{{lastItemIndex}} of {{totalNumberOfItems}}',
{
firstItemIndex,
lastItemIndex,
totalNumberOfItems,
}
)
}
/>
)
PaginationControls.propTypes = {
page: PropTypes.number,
pager: PropTypes.object,
onPageChange: PropTypes.func,
}
export default PaginationControls