@comicrelief/component-library 8.77.6 → 8.78.0

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.
Files changed (34) hide show
  1. package/dist/index.cjs.js +656 -596
  2. package/dist/index.es.js +10182 -10086
  3. package/package.json +1 -1
  4. package/src/components/Atoms/Button/Button.js +48 -6
  5. package/src/components/Atoms/Button/Button.style.js +46 -3
  6. package/src/components/Atoms/Button/Button.test.js +5 -2
  7. package/src/components/Atoms/Button/ButtonExample.jsx +263 -0
  8. package/src/components/Atoms/Icons/Cross.js +10 -3
  9. package/src/components/Atoms/Link/Link.style.js +2 -1
  10. package/src/components/Atoms/Link/Link.test.js +3 -1
  11. package/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +28 -28
  12. package/src/components/Molecules/CTA/CTAMultiCard/__snapshots__/CTAMultiCard.test.js.snap +56 -56
  13. package/src/components/Molecules/CTA/CTASingleCard/__snapshots__/CTASingleCard.test.js.snap +14 -14
  14. package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +34 -30
  15. package/src/components/Molecules/EmailSignUp/EmailSignUp.style.js +2 -0
  16. package/src/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +56 -56
  17. package/src/components/Molecules/PartnerLink/PartnerLink.test.js +14 -14
  18. package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +34 -30
  19. package/src/components/Molecules/QuoteSlice/__snapshots__/QuoteSlice.test.js.snap +3 -1
  20. package/src/components/Molecules/SearchResult/__snapshots__/SearchResult.test.js.snap +56 -56
  21. package/src/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +62 -58
  22. package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +17 -15
  23. package/src/components/Organisms/CookieBanner/CookieBanner.test.js +3 -1
  24. package/src/components/Organisms/DonateBanner/DonateBanner.style.js +4 -1
  25. package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +12 -4
  26. package/src/components/Organisms/DynamicGallery/__snapshots__/DynamicGallery.test.js.snap +12 -4
  27. package/src/components/Organisms/EmailBanner/EmailBanner.style.js +0 -7
  28. package/src/components/Organisms/EmailBanner/__snapshots__/EmailBanner.test.js.snap +20 -36
  29. package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +5 -2
  30. package/src/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +12 -4
  31. package/src/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +4 -4
  32. package/src/components/Organisms/Membership/Membership.test.js +14 -14
  33. package/src/data/data.js +6 -1
  34. package/src/theme/crTheme/buttonColors.js +21 -4
@@ -2,17 +2,19 @@
2
2
 
3
3
  exports[`Image banner left orientation renders correctly 1`] = `
4
4
  .c21 {
5
+ --padding-top-and-bottom: 0.6rem;
5
6
  display: inline-flex;
6
7
  position: relative;
7
8
  text-decoration: none;
8
9
  transition: all 0.2s;
9
- height: 2.5rem;
10
+ height: auto;
11
+ min-height: 3rem;
10
12
  width: 100%;
11
13
  justify-content: center;
12
14
  align-items: center;
13
15
  border: none;
14
16
  cursor: pointer;
15
- padding: 0.6rem 1rem;
17
+ padding: var(--padding-top-and-bottom) 1rem;
16
18
  border-radius: 0.5rem;
17
19
  background-color: #E52630;
18
20
  color: #FFFFFF;
@@ -33,6 +35,7 @@ exports[`Image banner left orientation renders correctly 1`] = `
33
35
  .c21:focus-within,
34
36
  .c21:focus-visible {
35
37
  background-color: #890B11;
38
+ color: #FFFFFF;
36
39
  outline-offset: 3px;
37
40
  }
38
41
 
@@ -271,7 +274,6 @@ exports[`Image banner left orientation renders correctly 1`] = `
271
274
 
272
275
  .c20 button {
273
276
  width: 100%;
274
- min-height: 48px;
275
277
  }
276
278
 
277
279
  @media (min-width: 740px) {
@@ -446,12 +448,6 @@ exports[`Image banner left orientation renders correctly 1`] = `
446
448
  }
447
449
  }
448
450
 
449
- @media (min-width: 740px) {
450
- .c20 button {
451
- padding: 1rem 2rem;
452
- }
453
- }
454
-
455
451
  <div
456
452
  className="c0"
457
453
  >
@@ -646,17 +642,19 @@ exports[`Image banner left orientation renders correctly 1`] = `
646
642
 
647
643
  exports[`Image banner renders correctly 1`] = `
648
644
  .c21 {
645
+ --padding-top-and-bottom: 0.6rem;
649
646
  display: inline-flex;
650
647
  position: relative;
651
648
  text-decoration: none;
652
649
  transition: all 0.2s;
653
- height: 2.5rem;
650
+ height: auto;
651
+ min-height: 3rem;
654
652
  width: 100%;
655
653
  justify-content: center;
656
654
  align-items: center;
657
655
  border: none;
658
656
  cursor: pointer;
659
- padding: 0.6rem 1rem;
657
+ padding: var(--padding-top-and-bottom) 1rem;
660
658
  border-radius: 0.5rem;
661
659
  background-color: #E52630;
662
660
  color: #FFFFFF;
@@ -677,6 +675,7 @@ exports[`Image banner renders correctly 1`] = `
677
675
  .c21:focus-within,
678
676
  .c21:focus-visible {
679
677
  background-color: #890B11;
678
+ color: #FFFFFF;
680
679
  outline-offset: 3px;
681
680
  }
682
681
 
@@ -915,7 +914,6 @@ exports[`Image banner renders correctly 1`] = `
915
914
 
916
915
  .c20 button {
917
916
  width: 100%;
918
- min-height: 48px;
919
917
  }
920
918
 
921
919
  @media (min-width: 740px) {
@@ -1090,12 +1088,6 @@ exports[`Image banner renders correctly 1`] = `
1090
1088
  }
1091
1089
  }
1092
1090
 
1093
- @media (min-width: 740px) {
1094
- .c20 button {
1095
- padding: 1rem 2rem;
1096
- }
1097
- }
1098
-
1099
1091
  <div
1100
1092
  className="c0"
1101
1093
  >
@@ -1290,17 +1282,19 @@ exports[`Image banner renders correctly 1`] = `
1290
1282
 
1291
1283
  exports[`Text-only email widget renders correctly 1`] = `
1292
1284
  .c21 {
1285
+ --padding-top-and-bottom: 0.6rem;
1293
1286
  display: inline-flex;
1294
1287
  position: relative;
1295
1288
  text-decoration: none;
1296
1289
  transition: all 0.2s;
1297
- height: 2.5rem;
1290
+ height: auto;
1291
+ min-height: 3rem;
1298
1292
  width: 100%;
1299
1293
  justify-content: center;
1300
1294
  align-items: center;
1301
1295
  border: none;
1302
1296
  cursor: pointer;
1303
- padding: 0.6rem 1rem;
1297
+ padding: var(--padding-top-and-bottom) 1rem;
1304
1298
  border-radius: 0.5rem;
1305
1299
  background-color: #E52630;
1306
1300
  color: #FFFFFF;
@@ -1321,6 +1315,7 @@ exports[`Text-only email widget renders correctly 1`] = `
1321
1315
  .c21:focus-within,
1322
1316
  .c21:focus-visible {
1323
1317
  background-color: #890B11;
1318
+ color: #FFFFFF;
1324
1319
  outline-offset: 3px;
1325
1320
  }
1326
1321
 
@@ -1559,7 +1554,6 @@ exports[`Text-only email widget renders correctly 1`] = `
1559
1554
 
1560
1555
  .c20 button {
1561
1556
  width: 100%;
1562
- min-height: 48px;
1563
1557
  }
1564
1558
 
1565
1559
  @media (min-width: 740px) {
@@ -1734,12 +1728,6 @@ exports[`Text-only email widget renders correctly 1`] = `
1734
1728
  }
1735
1729
  }
1736
1730
 
1737
- @media (min-width: 740px) {
1738
- .c20 button {
1739
- padding: 1rem 2rem;
1740
- }
1741
- }
1742
-
1743
1731
  <div
1744
1732
  className="c0"
1745
1733
  >
@@ -1934,17 +1922,19 @@ exports[`Text-only email widget renders correctly 1`] = `
1934
1922
 
1935
1923
  exports[`Text-only email widget with copyColor renders correctly 1`] = `
1936
1924
  .c21 {
1925
+ --padding-top-and-bottom: 0.6rem;
1937
1926
  display: inline-flex;
1938
1927
  position: relative;
1939
1928
  text-decoration: none;
1940
1929
  transition: all 0.2s;
1941
- height: 2.5rem;
1930
+ height: auto;
1931
+ min-height: 3rem;
1942
1932
  width: 100%;
1943
1933
  justify-content: center;
1944
1934
  align-items: center;
1945
1935
  border: none;
1946
1936
  cursor: pointer;
1947
- padding: 0.6rem 1rem;
1937
+ padding: var(--padding-top-and-bottom) 1rem;
1948
1938
  border-radius: 0.5rem;
1949
1939
  background-color: #E52630;
1950
1940
  color: #FFFFFF;
@@ -1965,6 +1955,7 @@ exports[`Text-only email widget with copyColor renders correctly 1`] = `
1965
1955
  .c21:focus-within,
1966
1956
  .c21:focus-visible {
1967
1957
  background-color: #890B11;
1958
+ color: #FFFFFF;
1968
1959
  outline-offset: 3px;
1969
1960
  }
1970
1961
 
@@ -2203,7 +2194,6 @@ exports[`Text-only email widget with copyColor renders correctly 1`] = `
2203
2194
 
2204
2195
  .c20 button {
2205
2196
  width: 100%;
2206
- min-height: 48px;
2207
2197
  }
2208
2198
 
2209
2199
  @media (min-width: 740px) {
@@ -2378,12 +2368,6 @@ exports[`Text-only email widget with copyColor renders correctly 1`] = `
2378
2368
  }
2379
2369
  }
2380
2370
 
2381
- @media (min-width: 740px) {
2382
- .c20 button {
2383
- padding: 1rem 2rem;
2384
- }
2385
- }
2386
-
2387
2371
  <div
2388
2372
  className="c0"
2389
2373
  >
@@ -2,17 +2,19 @@
2
2
 
3
3
  exports[`renders correctly 1`] = `
4
4
  .c15 {
5
+ --padding-top-and-bottom: 0.6rem;
5
6
  display: inline-flex;
6
7
  position: relative;
7
8
  text-decoration: none;
8
9
  transition: all 0.2s;
9
- height: 2.5rem;
10
+ height: auto;
11
+ min-height: 3rem;
10
12
  width: 100%;
11
13
  justify-content: center;
12
14
  align-items: center;
13
15
  border: none;
14
16
  cursor: pointer;
15
- padding: 0.6rem 1rem;
17
+ padding: var(--padding-top-and-bottom) 1rem;
16
18
  border-radius: 0.5rem;
17
19
  background-color: #E52630;
18
20
  color: #FFFFFF;
@@ -33,6 +35,7 @@ exports[`renders correctly 1`] = `
33
35
  .c15:focus-within,
34
36
  .c15:focus-visible {
35
37
  background-color: #890B11;
38
+ color: #FFFFFF;
36
39
  outline-offset: 3px;
37
40
  }
38
41
 
@@ -7,17 +7,19 @@ exports[`does not render copyright text when not supplied 1`] = `
7
7
  }
8
8
 
9
9
  .c23 {
10
+ --padding-top-and-bottom: 0.6rem;
10
11
  display: inline-flex;
11
12
  position: relative;
12
13
  text-decoration: none;
13
14
  transition: all 0.2s;
14
- height: 2.5rem;
15
+ height: auto;
16
+ min-height: 3rem;
15
17
  width: 100%;
16
18
  justify-content: center;
17
19
  align-items: center;
18
20
  border: none;
19
21
  cursor: pointer;
20
- padding: 0.6rem 1rem;
22
+ padding: var(--padding-top-and-bottom) 1rem;
21
23
  border-radius: 0.5rem;
22
24
  background-color: #FFFFFF;
23
25
  color: #000000;
@@ -38,6 +40,7 @@ exports[`does not render copyright text when not supplied 1`] = `
38
40
  .c23:focus-within,
39
41
  .c23:focus-visible {
40
42
  background-color: #E1E2E3;
43
+ color: #000000;
41
44
  outline-offset: 3px;
42
45
  }
43
46
 
@@ -305,6 +308,7 @@ exports[`does not render copyright text when not supplied 1`] = `
305
308
  border-radius: 0.5rem;
306
309
  overflow: hidden;
307
310
  min-width: max-content;
311
+ min-height: 2.25rem;
308
312
  width: 100%;
309
313
  }
310
314
 
@@ -1331,17 +1335,19 @@ exports[`renders correctly 1`] = `
1331
1335
  }
1332
1336
 
1333
1337
  .c23 {
1338
+ --padding-top-and-bottom: 0.6rem;
1334
1339
  display: inline-flex;
1335
1340
  position: relative;
1336
1341
  text-decoration: none;
1337
1342
  transition: all 0.2s;
1338
- height: 2.5rem;
1343
+ height: auto;
1344
+ min-height: 3rem;
1339
1345
  width: 100%;
1340
1346
  justify-content: center;
1341
1347
  align-items: center;
1342
1348
  border: none;
1343
1349
  cursor: pointer;
1344
- padding: 0.6rem 1rem;
1350
+ padding: var(--padding-top-and-bottom) 1rem;
1345
1351
  border-radius: 0.5rem;
1346
1352
  background-color: #FFFFFF;
1347
1353
  color: #000000;
@@ -1362,6 +1368,7 @@ exports[`renders correctly 1`] = `
1362
1368
  .c23:focus-within,
1363
1369
  .c23:focus-visible {
1364
1370
  background-color: #E1E2E3;
1371
+ color: #000000;
1365
1372
  outline-offset: 3px;
1366
1373
  }
1367
1374
 
@@ -1629,6 +1636,7 @@ exports[`renders correctly 1`] = `
1629
1636
  border-radius: 0.5rem;
1630
1637
  overflow: hidden;
1631
1638
  min-width: max-content;
1639
+ min-height: 2.25rem;
1632
1640
  width: 100%;
1633
1641
  }
1634
1642
 
@@ -4,21 +4,21 @@ import Link from '../../Atoms/Link/Link';
4
4
 
5
5
  const defaultCopyTop = (
6
6
  <div>
7
- <Text tag="h3" size="m" family="Montserrat" weight="600" color="black">
7
+ <Text tag="h3">
8
8
  Stay up to date with Comic Relief?
9
9
  </Text>
10
- <Text tag="p" size="md" color="black">
10
+ <Text tag="p">
11
11
  We’d like to send you updates on the work we’re funding and how
12
12
  your support makes a difference in the UK and around the world.
13
13
  </Text>
14
- <Text tag="p" size="md" color="black">
14
+ <Text tag="p">
15
15
  Please tick the relevant boxes below if you would like to hear from us.
16
16
  </Text>
17
17
  </div>
18
18
  );
19
19
 
20
20
  const defaultCopyBottom = (
21
- <Text tag="p" size="xs" color="black">
21
+ <Text tag="p" size="xs">
22
22
  Update your preferences at any time by visiting our
23
23
  {' '}
24
24
  <Link
@@ -25,6 +25,20 @@ it('renders correctly', () => {
25
25
  ).toJSON();
26
26
 
27
27
  expect(tree).toMatchInlineSnapshot(`
28
+ .c1 {
29
+ display: block;
30
+ width: 100%;
31
+ height: 100%;
32
+ position: relative;
33
+ }
34
+
35
+ .c3 {
36
+ width: 100%;
37
+ height: 100%;
38
+ display: block;
39
+ object-fit: cover;
40
+ }
41
+
28
42
  .c6 {
29
43
  font-family: 'Anton',Impact,sans-serif;
30
44
  font-weight: 400;
@@ -175,20 +189,6 @@ it('renders correctly', () => {
175
189
  border: 1px solid #666;
176
190
  }
177
191
 
178
- .c1 {
179
- display: block;
180
- width: 100%;
181
- height: 100%;
182
- position: relative;
183
- }
184
-
185
- .c3 {
186
- width: 100%;
187
- height: 100%;
188
- display: block;
189
- object-fit: cover;
190
- }
191
-
192
192
  .c15 {
193
193
  display: block;
194
194
  }
package/src/data/data.js CHANGED
@@ -342,9 +342,14 @@ const RichtextCarouselItemsWithPadding = {
342
342
  carouselBackgroundColour: 'grey_light'
343
343
  };
344
344
 
345
+ const ButtonIconImgPath = 'https://images.ctfassets.net/zsfivwzfgl3t/4IlLxZnddkg1pHWZP3AZnA/447078df666932751c9c618a296f24db/Icon__Shelter.png';
346
+
347
+ const ButtonIconSvgPath = 'https://images.ctfassets.net/0p265iutoxgq/3GaahqcCBaXrLBm5fu8HAj/d965a32d93fe82bf103c2f444e0bb9ec/Phone--white.svg';
348
+
345
349
  export {
346
350
  defaultData, mobileImages, testImpactSliderItems,
347
351
  carouselItemsComplete, carouselItemsCompleteWithPadding,
348
352
  carouselItemsIncomplete, carouselItemsMinimal,
349
- RichtextCarouselItems, RichtextCarouselItemsWithPadding
353
+ RichtextCarouselItems, RichtextCarouselItemsWithPadding,
354
+ ButtonIconImgPath, ButtonIconSvgPath
350
355
  };
@@ -83,6 +83,7 @@ const buttonColors = {
83
83
  textColour: color('black'),
84
84
  hoverBackground: color('grey_light'),
85
85
  hovertextColour: color('black')
86
+
86
87
  },
87
88
  grey_dark: {
88
89
  background: color('grey_dark'),
@@ -155,6 +156,7 @@ const buttonColors = {
155
156
  textColour: color('black'),
156
157
  hoverBackground: color('teal_light'),
157
158
  hovertextColour: color('black')
159
+
158
160
  },
159
161
  teal_dark: {
160
162
  background: color('teal_dark'),
@@ -170,9 +172,9 @@ const buttonColors = {
170
172
  },
171
173
  transparent: {
172
174
  background: 'rgba(255, 255, 255, 0.5)',
173
- color: 'inherit',
175
+ textColour: 'inherit',
174
176
  hoverBackground: 'rgba(255, 255, 255, 0.7)',
175
- hoverColor: 'inherit'
177
+ hovertextColour: 'inherit'
176
178
  },
177
179
  yellow: {
178
180
  background: color('yellow'),
@@ -204,14 +206,22 @@ export default (colorName, buttonType) => {
204
206
  style = css`
205
207
  background-color: ${buttonColors[thisColourName].background};
206
208
  color: ${buttonColors[thisColourName].textColour};
207
-
209
+
208
210
  &:hover,
209
211
  &:focus,
210
212
  &:focus-within,
211
213
  &:focus-visible {
212
214
  background-color: ${buttonColors[thisColourName].hoverBackground};
213
- color: ${buttonColors[thisColourName].hoverColor};
215
+ color: ${buttonColors[thisColourName].hovertextColour};
214
216
  outline-offset: 3px;
217
+
218
+ // If there's a hover change for this button, update the icon accordingly:
219
+ ${buttonColors[thisColourName].textColour !== buttonColors[thisColourName].hovertextColour && css`
220
+ // Frustratingly, using IconWrapper styled-component directly here borks the styles :(
221
+ .icon-wrapper {
222
+ filter: invert(1);
223
+ }
224
+ `}
215
225
  }
216
226
 
217
227
  &:disabled {
@@ -235,6 +245,13 @@ export default (colorName, buttonType) => {
235
245
  color: ${buttonColors[thisColourName].hoverBackground};
236
246
  background-color: transparent;
237
247
 
248
+ // Slight tweak of logic and filter type to suit the Secondary and Tertiary buttons:
249
+ ${buttonColors[thisColourName].background !== buttonColors[thisColourName].hoverBackground && css`
250
+ .icon-wrapper {
251
+ filter: brightness(70%);
252
+ }
253
+ `}
254
+
238
255
  ${buttonType === theme.buttonTypes.SECONDARY && css`
239
256
  box-shadow: 0px 0px 0px 2px ${buttonColors[thisColourName].hoverBackground} inset;
240
257
  `};