@comicrelief/component-library 7.35.5 → 7.35.7

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.
@@ -15,7 +15,7 @@ import { sizes } from '../../../theme/shared/breakpoint';
15
15
 
16
16
  const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
17
17
  // Defaults to mobile config:
18
- const [isMobileOrTablet, setIsMobileOrTablet] = useState(true);
18
+ const [isMobile, setIsMobile] = useState(true);
19
19
  const [visibleSlides, setVisibleSlides] = useState(1);
20
20
  const [totalSlides, setTotalSlides] = useState(null);
21
21
  const [theseItems, setTheseItems] = useState();
@@ -23,14 +23,14 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
23
23
  // Custom function to let us update the carousel config dynamically
24
24
  const screenResize = useCallback(() => {
25
25
  const screenSize = typeof window !== 'undefined' ? window.innerWidth : null;
26
- const isCurrentlyMobile = window.innerWidth < sizes.medium;
26
+ const isCurrentlyMobile = window.innerWidth < sizes.small;
27
27
 
28
- if (screenSize !== null && (isMobileOrTablet !== isCurrentlyMobile)) {
29
- setIsMobileOrTablet(isCurrentlyMobile);
28
+ if (screenSize !== null && (isMobile !== isCurrentlyMobile)) {
29
+ setIsMobile(isCurrentlyMobile);
30
30
  setVisibleSlides(isCurrentlyMobile ? 1 : 3);
31
31
  setTotalSlides(isCurrentlyMobile ? theseItems.length : theseItems.length + 2);
32
32
  }
33
- }, [isMobileOrTablet, theseItems]);
33
+ }, [isMobile, theseItems]);
34
34
 
35
35
  // Format our data BEFORE we use it in render:
36
36
  useEffect(() => {
@@ -38,10 +38,10 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
38
38
  }, [setTheseItems, data]);
39
39
 
40
40
  useEffect(() => {
41
- if (window !== 'undefined' && window.innerWidth >= sizes.medium) {
41
+ if (window !== 'undefined' && window.innerWidth >= sizes.small) {
42
42
  // On inital render, update carousel plugin config
43
43
  // to suit the non-mobile layout and functionality:
44
- setIsMobileOrTablet(false);
44
+ setIsMobile(false);
45
45
  setVisibleSlides(3);
46
46
  }
47
47
 
@@ -51,7 +51,7 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
51
51
 
52
52
  if (theseItems && totalSlides === null) {
53
53
  // Reflects our two dummy/bookend slides for non-mobile/tablet views:
54
- setTotalSlides(isMobileOrTablet ? theseItems.length : theseItems.length + 2);
54
+ setTotalSlides(isMobile ? theseItems.length : theseItems.length + 2);
55
55
  }
56
56
 
57
57
  return (
@@ -88,13 +88,13 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
88
88
  <Slider classNameAnimation="wymd-carousel">
89
89
 
90
90
  {/* Dummy slide for our desired non-mobile layout and functionality */}
91
- {isMobileOrTablet === false && (
91
+ {isMobile === false && (
92
92
  <Slide index={0} key={0} />
93
93
  )}
94
94
 
95
95
  {Object.keys(theseItems).map((key, index) => {
96
96
  // Reflect that initial dummy/bookend slide shown on non-mobile/tablet views:
97
- const thisOffsetIndex = index + (isMobileOrTablet ? 0 : 1);
97
+ const thisOffsetIndex = index + (isMobile ? 0 : 1);
98
98
 
99
99
  return (
100
100
  // Calculate the index offset accordingly to reflect the number of slides,
@@ -111,13 +111,13 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
111
111
 
112
112
  <div className="all-text-wrapper">
113
113
  <AmountWrapper>
114
- <Text tag="h1" family="Anton" uppercase weight="normal" size="xl">
114
+ <Text tag="h1" family="Anton" uppercase weight="normal">
115
115
  {theseItems[key].amount}
116
116
  </Text>
117
117
  </AmountWrapper>
118
118
 
119
119
  <CopyWrapper>
120
- <Text tag="p" size="m">
120
+ <Text tag="p">
121
121
  {theseItems[key].copy}
122
122
  </Text>
123
123
  </CopyWrapper>
@@ -128,7 +128,7 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
128
128
  })}
129
129
 
130
130
  {/* Dummy slide for our desired non-mobile layout and functionality */}
131
- {isMobileOrTablet === false && (
131
+ {isMobile === false && (
132
132
  <Slide index={theseItems.length + 1} key="bookend-last" />
133
133
  )}
134
134
 
@@ -145,87 +145,87 @@ const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
145
145
  WYMDCarousel.propTypes = {
146
146
  data: PropTypes.shape({
147
147
  // Required 'node' fields:
148
- node1_Amount: PropTypes.string.isRequired,
149
- node1_Copy: PropTypes.string.isRequired,
150
- node1_Image: PropTypes.shape({
148
+ node1Amount: PropTypes.string.isRequired,
149
+ node1Copy: PropTypes.string.isRequired,
150
+ node1Image: PropTypes.shape({
151
151
  file: PropTypes.shape({
152
152
  url: PropTypes.string.isRequired
153
153
  }).isRequired
154
154
  }).isRequired,
155
- node2_Amount: PropTypes.string.isRequired,
156
- node2_Copy: PropTypes.string.isRequired,
157
- node2_Image: PropTypes.shape({
155
+ node2Amount: PropTypes.string.isRequired,
156
+ node2Copy: PropTypes.string.isRequired,
157
+ node2Image: PropTypes.shape({
158
158
  file: PropTypes.shape({
159
159
  url: PropTypes.string.isRequired
160
160
  }).isRequired
161
161
  }).isRequired,
162
- node3_Amount: PropTypes.string.isRequired,
163
- node3_Copy: PropTypes.string.isRequired,
164
- node3_Image: PropTypes.shape({
162
+ node3Amount: PropTypes.string.isRequired,
163
+ node3Copy: PropTypes.string.isRequired,
164
+ node3Image: PropTypes.shape({
165
165
  file: PropTypes.shape({
166
166
  url: PropTypes.string.isRequired
167
167
  }).isRequired
168
168
  }).isRequired,
169
- node4_Amount: PropTypes.string.isRequired,
170
- node4_Copy: PropTypes.string.isRequired,
171
- node4_Image: PropTypes.shape({
169
+ node4Amount: PropTypes.string.isRequired,
170
+ node4Copy: PropTypes.string.isRequired,
171
+ node4Image: PropTypes.shape({
172
172
  file: PropTypes.shape({
173
173
  url: PropTypes.string.isRequired
174
174
  }).isRequired
175
175
  }).isRequired,
176
176
  // Non-required 'node' fields:
177
- node5_Amount: PropTypes.string,
178
- node5_Copy: PropTypes.string,
179
- node5_Image: PropTypes.shape({
177
+ node5Amount: PropTypes.string,
178
+ node5Copy: PropTypes.string,
179
+ node5Image: PropTypes.shape({
180
180
  file: PropTypes.shape({
181
181
  url: PropTypes.string
182
182
  })
183
183
  }),
184
- node6_Amount: PropTypes.string,
185
- node6_Copy: PropTypes.string,
186
- node6_Image: PropTypes.shape({
184
+ node6Amount: PropTypes.string,
185
+ node6Copy: PropTypes.string,
186
+ node6Image: PropTypes.shape({
187
187
  file: PropTypes.shape({
188
188
  url: PropTypes.string
189
189
  })
190
190
  }),
191
- node7_Amount: PropTypes.string,
192
- node7_Copy: PropTypes.string,
193
- node7_Image: PropTypes.shape({
191
+ node7Amount: PropTypes.string,
192
+ node7Copy: PropTypes.string,
193
+ node7Image: PropTypes.shape({
194
194
  file: PropTypes.shape({
195
195
  url: PropTypes.string
196
196
  })
197
197
  }),
198
- node8_Amount: PropTypes.string,
199
- node8_Copy: PropTypes.string,
200
- node8_Image: PropTypes.shape({
198
+ node8Amount: PropTypes.string,
199
+ node8Copy: PropTypes.string,
200
+ node8Image: PropTypes.shape({
201
201
  file: PropTypes.shape({
202
202
  url: PropTypes.string
203
203
  })
204
204
  }),
205
- node9_Amount: PropTypes.string,
206
- node9_Copy: PropTypes.string,
207
- node9_Image: PropTypes.shape({
205
+ node9Amount: PropTypes.string,
206
+ node9Copy: PropTypes.string,
207
+ node9Image: PropTypes.shape({
208
208
  file: PropTypes.shape({
209
209
  url: PropTypes.string
210
210
  })
211
211
  }),
212
- node10_Amount: PropTypes.string,
213
- node10_Copy: PropTypes.string,
214
- node10_Image: PropTypes.shape({
212
+ node10Amount: PropTypes.string,
213
+ node10Copy: PropTypes.string,
214
+ node10Image: PropTypes.shape({
215
215
  file: PropTypes.shape({
216
216
  url: PropTypes.string
217
217
  })
218
218
  }),
219
- node11_Amount: PropTypes.string,
220
- node11_Copy: PropTypes.string,
221
- node11_Image: PropTypes.shape({
219
+ node11Amount: PropTypes.string,
220
+ node11Copy: PropTypes.string,
221
+ node11Image: PropTypes.shape({
222
222
  file: PropTypes.shape({
223
223
  url: PropTypes.string
224
224
  })
225
225
  }),
226
- node12_Amount: PropTypes.string,
227
- node12_Copy: PropTypes.string,
228
- node12_Image: PropTypes.shape({
226
+ node12Amount: PropTypes.string,
227
+ node12Copy: PropTypes.string,
228
+ node12Image: PropTypes.shape({
229
229
  file: PropTypes.shape({
230
230
  url: PropTypes.string
231
231
  })
@@ -6,7 +6,7 @@ import Text from '../../Atoms/Text/Text';
6
6
  const animationSpeed = 0.75;
7
7
 
8
8
  // Use to calc positions when scaling copy
9
- const textScaleOffsetA = 50;
9
+ const textScaleOffsetA = 45;
10
10
  const textScaleOffsetB = 5;
11
11
 
12
12
  const ImageWrapper = styled.div`
@@ -21,6 +21,7 @@ const ImageWrapper = styled.div`
21
21
  img {
22
22
  width: 100%;
23
23
  height: auto;
24
+ display: block;
24
25
  }
25
26
 
26
27
  &:after {
@@ -44,15 +45,28 @@ const ImageWrapper = styled.div`
44
45
  `;
45
46
 
46
47
  const AmountWrapper = styled.div`
47
- padding: ${spacing('m')} 0;
48
- width: 75%;
49
- margin: 0 auto;
48
+ padding: ${spacing('m')} 0 0.75rem;
49
+
50
+ h1 {
51
+ font-size: 34px;
52
+ line-height: 37px;
53
+
54
+ @media ${({ theme }) => theme.breakpoint('small')} {
55
+ font-size: 40px;
56
+ line-height: 40px;
57
+ }
58
+ }
50
59
  `;
51
60
 
52
61
  const CopyWrapper = styled.div`
53
- padding: ${spacing('sm')} 0;
62
+ padding: 0;
54
63
  width: 75%;
55
64
  margin: 0 auto;
65
+
66
+ p {
67
+ font-size: ${({ theme }) => theme.fontSize('s')};
68
+ line-height: ${({ theme }) => theme.fontSize('l')};
69
+ }
56
70
  `;
57
71
 
58
72
  const Heading = styled(Text)`
@@ -134,19 +148,7 @@ const CarouselWrapper = styled.div`
134
148
  text-indent: -9999px;
135
149
  background-color: transparent;
136
150
  border: none;
137
-
138
- &:before {
139
- content: '';
140
- // Do we need some sort of icon here to show it's a button?
141
- // background: transparent url(/images/payin/CR__Chevron_D--white.svg) no-repeat;
142
- position: absolute;
143
- width: 30px;
144
- height: 30px;
145
- top: 50%;
146
- left: 0;
147
- transform: translate(0, -50%) rotate(90deg);
148
- }
149
-
151
+
150
152
  &:after {
151
153
  content: "";
152
154
  position: absolute;
@@ -155,20 +157,18 @@ const CarouselWrapper = styled.div`
155
157
  width: 50%;
156
158
  height: 100%;
157
159
  transition: opacity 0.2s linear;
158
- background: linear-gradient(90deg, rgba(255, 255, 255, 0.95),
160
+ background: linear-gradient(90deg, rgba(255, 255, 255, 1),
159
161
  rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
160
162
  }
161
163
 
162
164
 
163
165
  &:hover {
164
- // TO-DO: accessibiity?
165
- // border: 1px solid black;
166
166
  &:after {
167
167
  opacity: 0.5;
168
168
  }
169
169
  }
170
170
 
171
- @media ${({ theme }) => theme.breakpoint('medium')} {
171
+ @media ${({ theme }) => theme.breakpoint('small')} {
172
172
  width: 33.3% !important;
173
173
  &:after {
174
174
  width: 100%;
@@ -187,8 +187,8 @@ const CarouselWrapper = styled.div`
187
187
  &:after {
188
188
  left: auto;
189
189
  right: 0;
190
- background: linear-gradient(270deg, rgba(255, 255, 255, 0.95),
191
- rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
190
+ background: linear-gradient(270deg, rgba(255, 255, 255, 1),
191
+ rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
192
192
  }
193
193
  }
194
194
 
@@ -214,6 +214,10 @@ const CarouselWrapper = styled.div`
214
214
  }
215
215
 
216
216
  @media ${({ theme }) => theme.breakpoint('medium')} {
217
+ padding-bottom: ${props => props.tabletHeight}px !important;
218
+ }
219
+
220
+ @media ${({ theme }) => theme.breakpoint('small')} {
217
221
  padding-bottom: ${props => props.desktopHeight}px !important;
218
222
 
219
223
  // All slides:
@@ -237,7 +241,6 @@ const CarouselWrapper = styled.div`
237
241
  // Scale down ALL copy
238
242
  .all-text-wrapper {
239
243
  transition: transform ${animationSpeed}s ease;
240
- // HERE
241
244
  transform-origin: top;
242
245
  transform: translateY(calc(-${textScaleOffsetA}px + ${textScaleOffsetB}%)) scale(0.5)
243
246
  }
@@ -248,9 +251,9 @@ const CarouselWrapper = styled.div`
248
251
  .carousel__inner-slide {
249
252
  > div:first-child {
250
253
  &:after {
251
- right: calc(-250% - 6px);
254
+ right: calc(-300% - 6px);
252
255
  transform: scale(1);
253
- width: 250%;
256
+ width: 300%;
254
257
  }
255
258
  }
256
259
  }
@@ -262,9 +265,9 @@ const CarouselWrapper = styled.div`
262
265
  > div:first-child {
263
266
  transform: scale(1);
264
267
  &:after {
265
- right: calc(-187% - 6px);
268
+ right: calc(-222% - 6px);
266
269
  transform: scale(0.5);
267
- width: 250%;
270
+ width: 300%;
268
271
  }
269
272
  }
270
273
  }
@@ -278,20 +281,66 @@ const CarouselWrapper = styled.div`
278
281
  > div > div:first-child {
279
282
  transform: scale(0.5);
280
283
  &:after {
281
- right: calc(-250% - 6px);
284
+ right: calc(-300% - 6px);
282
285
  transform: scale(1);
283
- width: 250%;
286
+ width: 300%;
284
287
  }
285
288
  }
286
289
  .all-text-wrapper {
287
- // HERE
288
290
  transform: translateY(calc(-${textScaleOffsetA}px + ${textScaleOffsetB}%)) scale(0.5)
289
291
  }
290
292
  }
291
293
  }
292
294
  }
293
295
  }
294
-
296
+
297
+ // HERE WE GO
298
+ // START OF DESKTOP
299
+ @media ${({ theme }) => theme.breakpoint('medium')} {
300
+
301
+ // First
302
+ &.carousel__slide--visible {
303
+ .carousel__inner-slide {
304
+ > div:first-child {
305
+ &:after {
306
+ right: calc(-250% - 6px);
307
+ width: 250%;
308
+ }
309
+ }
310
+ }
311
+
312
+ // 2nd and 3rd
313
+ + .carousel__slide--visible {
314
+ .carousel__inner-slide {
315
+ > div:first-child {
316
+ &:after {
317
+ right: calc(-187% - 6px);
318
+ width: 250%;
319
+ }
320
+ }
321
+ }
322
+
323
+
324
+ // 3rd only
325
+ + .carousel__slide--visible {
326
+ .carousel__inner-slide {
327
+ > div:first-child {
328
+ &:after {
329
+ right: calc(-250% - 6px);
330
+ width: 250%;
331
+ }
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+
338
+ }
339
+
340
+ }
341
+ // END OF DESKTOP
342
+
343
+
295
344
  .carousel__inner-slide {
296
345
  text-align: center;
297
346
  display: inline-flex;
@@ -97,19 +97,6 @@ it("renders correctly", () => {
97
97
  border: none;
98
98
  }
99
99
 
100
- .c0 .carousel button.carousel__back-button:before,
101
- .c0 .carousel button.carousel__next-button:before {
102
- content: '';
103
- position: absolute;
104
- width: 30px;
105
- height: 30px;
106
- top: 50%;
107
- left: 0;
108
- -webkit-transform: translate(0,-50%) rotate(90deg);
109
- -ms-transform: translate(0,-50%) rotate(90deg);
110
- transform: translate(0,-50%) rotate(90deg);
111
- }
112
-
113
100
  .c0 .carousel button.carousel__back-button:after,
114
101
  .c0 .carousel button.carousel__next-button:after {
115
102
  content: "";
@@ -120,7 +107,7 @@ it("renders correctly", () => {
120
107
  height: 100%;
121
108
  -webkit-transition: opacity 0.2s linear;
122
109
  transition: opacity 0.2s linear;
123
- background: linear-gradient(90deg,rgba(255,255,255,0.95),rgba(255,255,255,0.5),rgba(255,255,255,0));
110
+ background: linear-gradient(90deg,rgba(255,255,255,1),rgba(255,255,255,0.5),rgba(255,255,255,0));
124
111
  }
125
112
 
126
113
  .c0 .carousel button.carousel__back-button:hover:after,
@@ -142,7 +129,7 @@ it("renders correctly", () => {
142
129
  .c0 .carousel button.carousel__next-button:after {
143
130
  left: auto;
144
131
  right: 0;
145
- background: linear-gradient(270deg,rgba(255,255,255,0.95),rgba(255,255,255,0.75),rgba(255,255,255,0));
132
+ background: linear-gradient(270deg,rgba(255,255,255,1),rgba(255,255,255,0.5),rgba(255,255,255,0));
146
133
  }
147
134
 
148
135
  .c0 .carousel .wymd-carousel {
@@ -218,7 +205,7 @@ it("renders correctly", () => {
218
205
  }
219
206
  }
220
207
 
221
- @media (min-width:1024px) {
208
+ @media (min-width:740px) {
222
209
  .c0 .carousel button.carousel__back-button,
223
210
  .c0 .carousel button.carousel__next-button {
224
211
  width: 33.3% !important;
@@ -237,6 +224,12 @@ it("renders correctly", () => {
237
224
  }
238
225
 
239
226
  @media (min-width:1024px) {
227
+ .c0 .carousel .wymd-carousel .carousel__slide {
228
+ padding-bottom: 500px !important;
229
+ }
230
+ }
231
+
232
+ @media (min-width:740px) {
240
233
  .c0 .carousel .wymd-carousel .carousel__slide {
241
234
  padding-bottom: 475px !important;
242
235
  }
@@ -268,17 +261,17 @@ it("renders correctly", () => {
268
261
  -webkit-transform-origin: top;
269
262
  -ms-transform-origin: top;
270
263
  transform-origin: top;
271
- -webkit-transform: translateY(calc(-50px + 5%)) scale(0.5);
272
- -ms-transform: translateY(calc(-50px + 5%)) scale(0.5);
273
- transform: translateY(calc(-50px + 5%)) scale(0.5);
264
+ -webkit-transform: translateY(calc(-45px + 5%)) scale(0.5);
265
+ -ms-transform: translateY(calc(-45px + 5%)) scale(0.5);
266
+ transform: translateY(calc(-45px + 5%)) scale(0.5);
274
267
  }
275
268
 
276
269
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible .carousel__inner-slide > div:first-child:after {
277
- right: calc(-250% - 6px);
270
+ right: calc(-300% - 6px);
278
271
  -webkit-transform: scale(1);
279
272
  -ms-transform: scale(1);
280
273
  transform: scale(1);
281
- width: 250%;
274
+ width: 300%;
282
275
  }
283
276
 
284
277
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible .carousel__inner-slide > div:first-child {
@@ -288,11 +281,11 @@ it("renders correctly", () => {
288
281
  }
289
282
 
290
283
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible .carousel__inner-slide > div:first-child:after {
291
- right: calc(-187% - 6px);
284
+ right: calc(-222% - 6px);
292
285
  -webkit-transform: scale(0.5);
293
286
  -ms-transform: scale(0.5);
294
287
  transform: scale(0.5);
295
- width: 250%;
288
+ width: 300%;
296
289
  }
297
290
 
298
291
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible .all-text-wrapper {
@@ -308,17 +301,34 @@ it("renders correctly", () => {
308
301
  }
309
302
 
310
303
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible + .carousel__slide--visible > div > div:first-child:after {
311
- right: calc(-250% - 6px);
304
+ right: calc(-300% - 6px);
312
305
  -webkit-transform: scale(1);
313
306
  -ms-transform: scale(1);
314
307
  transform: scale(1);
315
- width: 250%;
308
+ width: 300%;
316
309
  }
317
310
 
318
311
  .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible + .carousel__slide--visible .all-text-wrapper {
319
- -webkit-transform: translateY(calc(-50px + 5%)) scale(0.5);
320
- -ms-transform: translateY(calc(-50px + 5%)) scale(0.5);
321
- transform: translateY(calc(-50px + 5%)) scale(0.5);
312
+ -webkit-transform: translateY(calc(-45px + 5%)) scale(0.5);
313
+ -ms-transform: translateY(calc(-45px + 5%)) scale(0.5);
314
+ transform: translateY(calc(-45px + 5%)) scale(0.5);
315
+ }
316
+ }
317
+
318
+ @media (min-width:1024px) {
319
+ .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible .carousel__inner-slide > div:first-child:after {
320
+ right: calc(-250% - 6px);
321
+ width: 250%;
322
+ }
323
+
324
+ .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible .carousel__inner-slide > div:first-child:after {
325
+ right: calc(-187% - 6px);
326
+ width: 250%;
327
+ }
328
+
329
+ .c0 .carousel .wymd-carousel .carousel__slide.carousel__slide--visible + .carousel__slide--visible + .carousel__slide--visible .carousel__inner-slide > div:first-child:after {
330
+ right: calc(-250% - 6px);
331
+ width: 250%;
322
332
  }
323
333
  }
324
334
 
@@ -13,7 +13,7 @@ const formatItems = thisData => {
13
13
  for (let i = 1; i <= possibleNumberOfNodes; i += 1) {
14
14
  // Create a dynamic key prefix based on the counter, obviously matching
15
15
  // the naming convention set at the Content Type level in the CMS
16
- const thisKeyPrefix = `node${i}_`;
16
+ const thisKeyPrefix = `node${i}`;
17
17
 
18
18
  // Make an array of objects, each object representing a specific node and its fields:
19
19
  const thisNodeContent = theseKeys
@@ -23,7 +23,7 @@ const formatItems = thisData => {
23
23
  // Only assign if we have actually have a value; only the fields for nodes 1-4 are required:
24
24
  if (thisData[thisKey]) {
25
25
  // Use a repeatable, generic key so rendering is a LOT easier:
26
- const simplifedKey = thisKey.split('_').pop().toLowerCase();
26
+ const simplifedKey = thisKey.split(/([0-9])/).pop().toLowerCase();
27
27
  thisFilteredObj[simplifedKey] = thisData[thisKey];
28
28
  }
29
29
  return thisFilteredObj;