UNPKG

@thehappycoder/react-responsive-pagination

Version:
19 lines (18 loc) 722 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function createItemWidthCalculator(_a) { var getPageWidth = _a.getPageWidth, getNavWidth = _a.getNavWidth, ellipsisWidth = _a.ellipsisWidth; return function itemWidthCalculator(item) { if (item.type === 'page') { return getPageWidth(item.page, item.active); } if (item.type === 'previous' || item.type === 'next') { return getNavWidth(item.type, item.page !== undefined); } if (item.type === 'ellipsis') { return ellipsisWidth; } throw Error("unknown item: " + item.type); }; } exports.createItemWidthCalculator = createItemWidthCalculator;