UNPKG

@s-ui/react-molecule-pagination

Version:

`MoleculePagination` is a component that displays a range of pages with the current page highlighted and the proper buttons to navigate across the available pages in the entire range of total pages

22 lines (21 loc) 779 B
import { getMessageErrorInRange, getMessageErrorNumber, getMessageErrorPositive } from './helpers.js'; var isValidShowPages = function isValidShowPages(props, propName, componentName) { var showPages = props[propName]; var totalPages = props.totalPages; if (showPages === undefined) return null; if (typeof showPages !== 'number') return new Error(getMessageErrorNumber({ propName: propName, componentName: componentName })); if (showPages <= 0) return new Error(getMessageErrorPositive({ propName: propName, componentName: componentName })); if (showPages > totalPages) return new Error(getMessageErrorInRange({ propName: propName, componentName: componentName })); // assume all ok return null; }; export default isValidShowPages;