Sha256: 8056fd9401cfe44db18ad61bd7c06cc7dbb7a2919fef70dd6b54f05a35c72060
Contents?: true
Size: 1.62 KB
Versions: 9
Compression:
Stored size: 1.62 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Table, TableHeader, TableBody } from '@patternfly/react-table'; import { Flex, FlexItem } from '@patternfly/react-core'; import Pagination from 'foremanReact/components/Pagination'; import { refreshPage } from './IndexTableHelper'; const IndexTable = ({ history, pagination, totalCount, toolbarBtns, ariaTableLabel, columns, ...rest }) => { const handlePerPageSelected = perPage => { refreshPage(history, { page: 1, perPage }); }; const handlePageSelected = page => { refreshPage(history, { ...pagination, page }); }; return ( <React.Fragment> <Flex className="pf-u-pt-md"> <FlexItem>{toolbarBtns}</FlexItem> <FlexItem align={{ default: 'alignRight' }}> <Pagination itemCount={totalCount} page={pagination.page} perPage={pagination.perPage} onSetPage={handlePageSelected} onPerPageSelect={handlePerPageSelected} variant="top" /> </FlexItem> </Flex> <Table aria-label={ariaTableLabel} cells={columns} {...rest} variant="compact" > <TableHeader /> <TableBody /> </Table> </React.Fragment> ); }; IndexTable.propTypes = { history: PropTypes.object.isRequired, pagination: PropTypes.object.isRequired, toolbarBtns: PropTypes.node, totalCount: PropTypes.number.isRequired, ariaTableLabel: PropTypes.string.isRequired, columns: PropTypes.array.isRequired, }; IndexTable.defaultProps = { toolbarBtns: null, }; export default IndexTable;
Version data entries
9 entries across 9 versions & 1 rubygems