@citygross/components 0.7.186 → 0.7.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare type TPagination = {
|
|
3
3
|
totalItems?: number;
|
|
4
4
|
fetchItems: (page: number) => void;
|
|
@@ -6,5 +6,7 @@ export declare type TPagination = {
|
|
|
6
6
|
itemsPerPage?: number;
|
|
7
7
|
setPage?: (page: number) => void;
|
|
8
8
|
numOfPaginationsToShow?: number;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
leftIcon?: React.ReactNode;
|
|
9
11
|
};
|
|
10
|
-
export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow }: TPagination): JSX.Element;
|
|
12
|
+
export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow, rightIcon, leftIcon }: TPagination): JSX.Element;
|
|
@@ -39,7 +39,7 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
|
39
39
|
}
|
|
40
40
|
function Pagination(_a) {
|
|
41
41
|
var _b;
|
|
42
|
-
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c;
|
|
42
|
+
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c, rightIcon = _a.rightIcon, leftIcon = _a.leftIcon;
|
|
43
43
|
var _d = React.useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
|
|
44
44
|
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
45
45
|
return (React__default["default"].createElement(Box.Box, null, pagination && pagination.length > 0 && (React__default["default"].createElement(Pagination_styles.Flex, null,
|
|
@@ -47,11 +47,11 @@ function Pagination(_a) {
|
|
|
47
47
|
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () {
|
|
48
48
|
setPage && setPage(currentPage - 1);
|
|
49
49
|
setIndex(currentIndex - 1);
|
|
50
|
-
}, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
50
|
+
}, width: 36, height: 36 }, leftIcon || '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
51
51
|
_b.map(function (page) { return (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, { key: page },
|
|
52
52
|
React__default["default"].createElement(PaginationButton.PaginationButton, { color: currentPage === page + 1 ? 'primary' : 'white', width: 36, height: 36, onClick: function () { return fetchItems(page + 1); } }, page + 1))); }),
|
|
53
53
|
pagination.length > 1 && currentIndex < pagination.length - 1 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
|
|
54
|
-
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
|
|
54
|
+
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, rightIcon || '...')))))));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
exports.Pagination = Pagination;
|
|
@@ -31,7 +31,7 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
|
31
31
|
}
|
|
32
32
|
function Pagination(_a) {
|
|
33
33
|
var _b;
|
|
34
|
-
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c;
|
|
34
|
+
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c, rightIcon = _a.rightIcon, leftIcon = _a.leftIcon;
|
|
35
35
|
var _d = useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
|
|
36
36
|
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
37
37
|
return (React.createElement(Box, null, pagination && pagination.length > 0 && (React.createElement(Flex, null,
|
|
@@ -39,11 +39,11 @@ function Pagination(_a) {
|
|
|
39
39
|
React.createElement(PaginationButton, { color: 'white', onClick: function () {
|
|
40
40
|
setPage && setPage(currentPage - 1);
|
|
41
41
|
setIndex(currentIndex - 1);
|
|
42
|
-
}, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
42
|
+
}, width: 36, height: 36 }, leftIcon || '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
43
43
|
_b.map(function (page) { return (React.createElement(PaginationButtonWrapper, { key: page },
|
|
44
44
|
React.createElement(PaginationButton, { color: currentPage === page + 1 ? 'primary' : 'white', width: 36, height: 36, onClick: function () { return fetchItems(page + 1); } }, page + 1))); }),
|
|
45
45
|
pagination.length > 1 && currentIndex < pagination.length - 1 && (React.createElement(PaginationButtonWrapper, null,
|
|
46
|
-
React.createElement(PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
|
|
46
|
+
React.createElement(PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, rightIcon || '...')))))));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export { Pagination };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.187",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./build/cjs/components/src/index.js",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"moment": "^2.29.1",
|
|
72
72
|
"react-loading-skeleton": "^2.2.0"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "cfef6d6070ee32f7fe2e1418d7b356b929148f8d"
|
|
75
75
|
}
|