-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTableFooter.tsx
More file actions
28 lines (26 loc) · 907 Bytes
/
TableFooter.tsx
File metadata and controls
28 lines (26 loc) · 907 Bytes
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
import { Context, useContext } from 'react';
import { DataTableContextShape } from '@src/paragon';
import { useIntl } from '@edx/frontend-platform/i18n';
import { DataTableContext, Pagination, TableFooter } from '@openedx/paragon';
import messages from '../messages';
const Footer = () => {
const { formatMessage } = useIntl();
const {
pageCount, gotoPage, state, itemCount, rows,
} = useContext(DataTableContext as unknown as Context<DataTableContextShape>);
const { pageIndex } = state;
return (
<TableFooter>
<span>
{formatMessage(messages['authz.table.footer.items.showing.text'], { pageSize: rows.length, itemCount })}
</span>
<Pagination
variant="reduced"
currentPage={pageIndex + 1}
pageCount={pageCount}
onPageSelect={(pageNum: number) => gotoPage(pageNum - 1)}
/>
</TableFooter>
);
};
export default Footer;