UNPKG

box-ui-elements-mlh

Version:
37 lines (31 loc) 922 B
/** * @flow * @file Pagination component * @author Box */ import React from 'react'; import MarkerBasedPagination from './MarkerBasedPagination'; import OffsetBasedPagination from './OffsetBasedPagination'; import './Pagination.scss'; type Props = { hasNextMarker?: boolean, hasPrevMarker?: boolean, offset?: number, onMarkerBasedPageChange?: Function, onOffsetChange?: Function, pageSize?: number, totalCount?: number, }; const Pagination = ({ hasNextMarker, hasPrevMarker, onMarkerBasedPageChange, ...rest }: Props) => { if (hasNextMarker || hasPrevMarker) { return ( <MarkerBasedPagination hasNextMarker={hasNextMarker} hasPrevMarker={hasPrevMarker} onMarkerBasedPageChange={onMarkerBasedPageChange} /> ); } return <OffsetBasedPagination {...rest} />; }; export default Pagination;