@citygross/components 0.7.180 → 0.7.182
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.
- package/build/@types/components/Pagination/Pagination.d.ts +2 -1
- package/build/cjs/components/src/components/MenuListItem/MenuListItem.styles.js +1 -1
- package/build/cjs/components/src/components/Pagination/Pagination.js +5 -5
- package/build/es/components/src/components/MenuListItem/MenuListItem.styles.js +1 -1
- package/build/es/components/src/components/Pagination/Pagination.js +5 -5
- package/package.json +2 -2
|
@@ -5,5 +5,6 @@ export declare type TPagination = {
|
|
|
5
5
|
currentPage: number;
|
|
6
6
|
itemsPerPage?: number;
|
|
7
7
|
setPage?: (page: number) => void;
|
|
8
|
+
numOfPaginationsToShow?: number;
|
|
8
9
|
};
|
|
9
|
-
export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage }: TPagination): JSX.Element;
|
|
10
|
+
export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow }: TPagination): JSX.Element;
|
|
@@ -12,7 +12,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
12
12
|
var MenuListItemWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
|
|
13
13
|
var MainCategoryWrapper = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"], ["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return props.isOpen ? props.backgroundColor : (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xl; }, function (props) { return props.hoverBackground && "background:".concat(props.hoverBackground); });
|
|
14
14
|
var NestedWrapper = styled__default["default"](MainCategoryWrapper)(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n padding: ", ";\n display: flex;\n flex-direction: column;\n"], ["\n padding: ", ";\n display: flex;\n flex-direction: column;\n"])), function (props) { var _a; return (props.nested ? 0 : "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px")); });
|
|
15
|
-
var HeaderWrapper = styled__default["default"](MainCategoryWrapper)(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n"])), function (props) { return props.paddingLeft; });
|
|
15
|
+
var HeaderWrapper = styled__default["default"](MainCategoryWrapper)(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n * > {\n min-width: 16px;\n }\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n * > {\n min-width: 16px;\n }\n"])), function (props) { return props.paddingLeft; });
|
|
16
16
|
styled__default["default"](MainCategoryWrapper)(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n padding-left: ", "px;\n align-self: flex-start;\n"], ["\n padding-left: ", "px;\n align-self: flex-start;\n"])), function (props) { return props.paddingLeft; });
|
|
17
17
|
var HeaderText = styled__default["default"].h2(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"], ["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.lineHeight.m2; });
|
|
18
18
|
var BodyText = styled__default["default"].p(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n display: flex;\n gap: ", "px;\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n color: ", ";\n"], ["\n display: flex;\n gap: ", "px;\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n color: ", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s2; }, function (props) {
|
|
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
-
function createPagination(totalItems, itemsPerPage) {
|
|
14
|
+
function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
15
15
|
var amountOfPages = Math.ceil((totalItems || 0) / (itemsPerPage !== null && itemsPerPage !== void 0 ? itemsPerPage : 6));
|
|
16
16
|
if (amountOfPages === 0 || itemsPerPage === 0) {
|
|
17
17
|
return [];
|
|
@@ -20,7 +20,7 @@ function createPagination(totalItems, itemsPerPage) {
|
|
|
20
20
|
var block = [];
|
|
21
21
|
var counter = 0;
|
|
22
22
|
new Array(amountOfPages).fill(0).map(function (_, index) {
|
|
23
|
-
if (counter <
|
|
23
|
+
if (counter < (numOfPaginationsToShow !== null && numOfPaginationsToShow !== void 0 ? numOfPaginationsToShow : 4) - 1) {
|
|
24
24
|
counter++;
|
|
25
25
|
block.push(index);
|
|
26
26
|
if (index === amountOfPages - 1) {
|
|
@@ -38,9 +38,9 @@ function createPagination(totalItems, itemsPerPage) {
|
|
|
38
38
|
return pagination;
|
|
39
39
|
}
|
|
40
40
|
function Pagination(_a) {
|
|
41
|
-
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage;
|
|
42
|
-
var
|
|
43
|
-
var pagination = createPagination(totalItems, itemsPerPage);
|
|
41
|
+
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _b = _a.numOfPaginationsToShow, numOfPaginationsToShow = _b === void 0 ? 4 : _b;
|
|
42
|
+
var _c = React.useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _c[0], setIndex = _c[1];
|
|
43
|
+
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
44
44
|
return (React__default["default"].createElement(Box.Box, null, pagination && pagination.length > 0 && (React__default["default"].createElement(Pagination_styles.Flex, null,
|
|
45
45
|
currentIndex > 0 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
|
|
46
46
|
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () {
|
|
@@ -4,7 +4,7 @@ import styled from 'styled-components';
|
|
|
4
4
|
var MenuListItemWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
|
|
5
5
|
var MainCategoryWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"], ["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return props.isOpen ? props.backgroundColor : (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xl; }, function (props) { return props.hoverBackground && "background:".concat(props.hoverBackground); });
|
|
6
6
|
var NestedWrapper = styled(MainCategoryWrapper)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", ";\n display: flex;\n flex-direction: column;\n"], ["\n padding: ", ";\n display: flex;\n flex-direction: column;\n"])), function (props) { var _a; return (props.nested ? 0 : "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px")); });
|
|
7
|
-
var HeaderWrapper = styled(MainCategoryWrapper)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n"])), function (props) { return props.paddingLeft; });
|
|
7
|
+
var HeaderWrapper = styled(MainCategoryWrapper)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n * > {\n min-width: 16px;\n }\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n * > {\n min-width: 16px;\n }\n"])), function (props) { return props.paddingLeft; });
|
|
8
8
|
styled(MainCategoryWrapper)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-left: ", "px;\n align-self: flex-start;\n"], ["\n padding-left: ", "px;\n align-self: flex-start;\n"])), function (props) { return props.paddingLeft; });
|
|
9
9
|
var HeaderText = styled.h2(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"], ["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.lineHeight.m2; });
|
|
10
10
|
var BodyText = styled.p(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n gap: ", "px;\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n color: ", ";\n"], ["\n display: flex;\n gap: ", "px;\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n color: ", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s2; }, function (props) {
|
|
@@ -3,7 +3,7 @@ import { PaginationButton } from '../Button/PaginationButton.js';
|
|
|
3
3
|
import { Box } from '../Box/Box.js';
|
|
4
4
|
import { Flex, PaginationButtonWrapper } from './Pagination.styles.js';
|
|
5
5
|
|
|
6
|
-
function createPagination(totalItems, itemsPerPage) {
|
|
6
|
+
function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
7
7
|
var amountOfPages = Math.ceil((totalItems || 0) / (itemsPerPage !== null && itemsPerPage !== void 0 ? itemsPerPage : 6));
|
|
8
8
|
if (amountOfPages === 0 || itemsPerPage === 0) {
|
|
9
9
|
return [];
|
|
@@ -12,7 +12,7 @@ function createPagination(totalItems, itemsPerPage) {
|
|
|
12
12
|
var block = [];
|
|
13
13
|
var counter = 0;
|
|
14
14
|
new Array(amountOfPages).fill(0).map(function (_, index) {
|
|
15
|
-
if (counter <
|
|
15
|
+
if (counter < (numOfPaginationsToShow !== null && numOfPaginationsToShow !== void 0 ? numOfPaginationsToShow : 4) - 1) {
|
|
16
16
|
counter++;
|
|
17
17
|
block.push(index);
|
|
18
18
|
if (index === amountOfPages - 1) {
|
|
@@ -30,9 +30,9 @@ function createPagination(totalItems, itemsPerPage) {
|
|
|
30
30
|
return pagination;
|
|
31
31
|
}
|
|
32
32
|
function Pagination(_a) {
|
|
33
|
-
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage;
|
|
34
|
-
var
|
|
35
|
-
var pagination = createPagination(totalItems, itemsPerPage);
|
|
33
|
+
var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _b = _a.numOfPaginationsToShow, numOfPaginationsToShow = _b === void 0 ? 4 : _b;
|
|
34
|
+
var _c = useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _c[0], setIndex = _c[1];
|
|
35
|
+
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
36
36
|
return (React.createElement(Box, null, pagination && pagination.length > 0 && (React.createElement(Flex, null,
|
|
37
37
|
currentIndex > 0 && (React.createElement(PaginationButtonWrapper, null,
|
|
38
38
|
React.createElement(PaginationButton, { color: 'white', onClick: function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.182",
|
|
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": "e633b867f857b92ecd95983f0d30f05d5c98db7f"
|
|
75
75
|
}
|