@thecb/components 7.7.4-beta.5 → 7.7.4-beta.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.7.4-beta.5",
3
+ "version": "7.7.4-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  import React, { useContext } from "react";
2
2
  import { ThemeContext } from "styled-components";
3
3
 
4
- import { Cluster, Box } from "../../atoms/layouts";
4
+ import { Cluster, Cover, Box } from "../../atoms/layouts";
5
5
  import Text from "../../atoms/text";
6
6
  import ButtonWithAction from "../../atoms/button-with-action";
7
7
  import { ChevronIcon } from "../../atoms/icons";
@@ -92,9 +92,9 @@ const Pagination = ({
92
92
  activeBorderWidth = "3px",
93
93
  arrowColor,
94
94
  borderRadius = "3px",
95
- buttonHeight = "40px",
96
- buttonWidth = "40px",
97
- childGap = "10px",
95
+ buttonHeight = "44px",
96
+ buttonWidth = "44px",
97
+ childGap = "24px",
98
98
  currentPage,
99
99
  fontSize = "17px",
100
100
  fontWeight = "900",
@@ -127,88 +127,88 @@ const Pagination = ({
127
127
  />
128
128
  )
129
129
  )}
130
- {isMobile ? (
131
- <Box padding="0">
132
- <Cluster justify="flex-end">
133
- <Text
134
- variant="pXL"
135
- weight={fontWeight}
136
- color={numberColor ?? themeValues.numberColor}
137
- extraStyles={`font-size: ${fontSize}`}
138
- >
139
- {`${currentPage} of ${pageCount}`}
140
- </Text>
141
- </Cluster>
142
- </Box>
143
- ) : (
144
- getPagesPanel(currentPage, pageCount).map((item, index) =>
145
- item.isButton ? (
146
- <Box padding="0" extraStyles={`max-height: ${buttonHeight};`}>
147
- <ButtonWithAction
148
- variant="ghost"
149
- key={item.index}
150
- text={item.index}
151
- disabled={item.active}
152
- extraDisabledStyles={`
153
- border: ${activeBorderWidth} solid ${numberColor ??
154
- themeValues.numberColor};
155
- color: ${numberColor ?? themeValues.activeColor};
156
- background-color: ${themeValues.activeBackgroundColor};
157
- &:focus {
158
- box-shadow: none;
159
- }
160
- &:hover {
161
- background-color: initial;
162
- }
163
- `}
164
- action={
165
- !item.active
166
- ? () => setCurrentPage({ pageNumber: item.index })
167
- : noop
168
- }
169
- textExtraStyles={`font-size: ${fontSize}; font-weight: ${fontWeight};`}
170
- extraStyles={`
171
- min-width: ${buttonWidth}; min-height: 100%; padding: 0;
172
- border-radius: ${borderRadius};
173
- &:hover, &:focus {
174
- text-decoration: none;
175
- > * > span {
176
- text-decoration: none;
177
- }
178
- }
179
- > * > span {
180
- color: ${numberColor ?? themeValues.numberColor}
181
- }
182
- margin: 0;
183
- &:hover {
184
- background-color: ${themeValues.hoverBackgroundColor}
185
- }
186
- &:focus {
187
- outline: none
188
- }
189
- `}
190
- dataQa={index}
191
- >
192
- {item.index}
193
- </ButtonWithAction>
194
- </Box>
195
- ) : (
196
- <Box padding="0 10px">
197
- <Cluster justify="flex-end">
130
+ {isMobile
131
+ ? pageCount > 0 && (
132
+ <Box padding="0">
133
+ <Cover singleChild>
198
134
  <Text
199
- key={index}
200
135
  variant="pXL"
201
136
  weight={fontWeight}
202
137
  color={numberColor ?? themeValues.numberColor}
203
138
  extraStyles={`font-size: ${fontSize}`}
204
139
  >
205
- {"..."}
140
+ {`${currentPage} of ${pageCount}`}
206
141
  </Text>
207
- </Cluster>
142
+ </Cover>
208
143
  </Box>
209
144
  )
210
- )
211
- )}
145
+ : getPagesPanel(currentPage, pageCount).map((item, index) =>
146
+ item.isButton ? (
147
+ <Box padding="0" extraStyles={`max-height: ${buttonHeight};`}>
148
+ <ButtonWithAction
149
+ variant="ghost"
150
+ key={item.index}
151
+ text={item.index}
152
+ disabled={item.active}
153
+ extraDisabledStyles={`
154
+ border: ${activeBorderWidth} solid ${numberColor ??
155
+ themeValues.numberColor};
156
+ color: ${numberColor ?? themeValues.activeColor};
157
+ background-color: ${themeValues.activeBackgroundColor};
158
+ &:focus {
159
+ box-shadow: none;
160
+ }
161
+ &:hover {
162
+ background-color: initial;
163
+ }
164
+ `}
165
+ action={
166
+ !item.active
167
+ ? () => setCurrentPage({ pageNumber: item.index })
168
+ : noop
169
+ }
170
+ textExtraStyles={`font-size: ${fontSize}; font-weight: ${fontWeight};`}
171
+ extraStyles={`
172
+ min-width: ${buttonWidth}; min-height: 100%; padding: 0;
173
+ border-radius: ${borderRadius};
174
+ &:hover, &:focus {
175
+ text-decoration: none;
176
+ > * > span {
177
+ text-decoration: none;
178
+ }
179
+ }
180
+ > * > span {
181
+ color: ${numberColor ?? themeValues.numberColor}
182
+ }
183
+ margin: 0;
184
+ &:hover {
185
+ background-color: ${themeValues.hoverBackgroundColor}
186
+ }
187
+ &:focus {
188
+ outline: none
189
+ }
190
+ `}
191
+ dataQa={index}
192
+ >
193
+ {item.index}
194
+ </ButtonWithAction>
195
+ </Box>
196
+ ) : (
197
+ <Box padding="0 10px">
198
+ <Cluster justify="flex-end">
199
+ <Text
200
+ key={index}
201
+ variant="pXL"
202
+ weight={fontWeight}
203
+ color={numberColor ?? themeValues.numberColor}
204
+ extraStyles={`font-size: ${fontSize}`}
205
+ >
206
+ {"..."}
207
+ </Text>
208
+ </Cluster>
209
+ </Box>
210
+ )
211
+ )}
212
212
  {currentPage < pageCount ? (
213
213
  <PrevNextButton
214
214
  action={pageNext}