@comicrelief/component-library 8.52.2 → 8.53.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 (50) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/dist/components/Molecules/CTA/CTAMultiCard/CTAMultiCard.md +1 -0
  3. package/dist/components/Molecules/CTA/CTAMultiCard/__snapshots__/CTAMultiCard.test.js.snap +280 -232
  4. package/dist/components/Molecules/CTA/CTASingleCard/__snapshots__/CTASingleCard.test.js.snap +68 -28
  5. package/dist/components/Molecules/CTA/shared/CTACard.js +1 -1
  6. package/dist/components/Molecules/CTA/shared/CTACard.style.js +11 -7
  7. package/dist/components/Organisms/Donate/Donate.js +3 -0
  8. package/dist/components/Organisms/Donate/Form/Form.js +0 -1
  9. package/dist/components/Organisms/DonateBanner/DonateBanner.js +132 -0
  10. package/dist/components/Organisms/DonateBanner/DonateBanner.md +168 -0
  11. package/dist/components/Organisms/DonateBanner/DonateBanner.style.js +291 -0
  12. package/dist/components/Organisms/DonateBanner/DonateBanner.test.js +134 -0
  13. package/dist/components/Organisms/DonateBanner/Form/Form.js +214 -0
  14. package/dist/components/Organisms/DonateBanner/Form/PopUpComponent.js +70 -0
  15. package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +50 -0
  16. package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +73 -0
  17. package/dist/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +83 -0
  18. package/dist/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +3170 -0
  19. package/dist/components/Organisms/DonateBanner/_utils.js +41 -0
  20. package/dist/components/Organisms/DonateBanner/assets/close.svg +3 -0
  21. package/dist/components/Organisms/DonateBanner/dev-data/data-high-value.js +33 -0
  22. package/dist/components/Organisms/DonateBanner/dev-data/data-monthly.js +22 -0
  23. package/dist/components/Organisms/DonateBanner/dev-data/data-single.js +22 -0
  24. package/dist/components/Organisms/DonateBanner/dev-data/data.js +33 -0
  25. package/dist/index.js +7 -0
  26. package/package.json +1 -1
  27. package/src/components/Molecules/CTA/CTAMultiCard/CTAMultiCard.md +1 -0
  28. package/src/components/Molecules/CTA/CTAMultiCard/__snapshots__/CTAMultiCard.test.js.snap +280 -232
  29. package/src/components/Molecules/CTA/CTASingleCard/__snapshots__/CTASingleCard.test.js.snap +68 -28
  30. package/src/components/Molecules/CTA/shared/CTACard.js +6 -3
  31. package/src/components/Molecules/CTA/shared/CTACard.style.js +8 -0
  32. package/src/components/Organisms/Donate/Donate.js +5 -0
  33. package/src/components/Organisms/Donate/Form/Form.js +0 -1
  34. package/src/components/Organisms/DonateBanner/DonateBanner.js +210 -0
  35. package/src/components/Organisms/DonateBanner/DonateBanner.md +168 -0
  36. package/src/components/Organisms/DonateBanner/DonateBanner.style.js +320 -0
  37. package/src/components/Organisms/DonateBanner/DonateBanner.test.js +151 -0
  38. package/src/components/Organisms/DonateBanner/Form/Form.js +332 -0
  39. package/src/components/Organisms/DonateBanner/Form/PopUpComponent.js +110 -0
  40. package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +61 -0
  41. package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +71 -0
  42. package/src/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +58 -0
  43. package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +3170 -0
  44. package/src/components/Organisms/DonateBanner/_utils.js +34 -0
  45. package/src/components/Organisms/DonateBanner/assets/close.svg +3 -0
  46. package/src/components/Organisms/DonateBanner/dev-data/data-high-value.js +41 -0
  47. package/src/components/Organisms/DonateBanner/dev-data/data-monthly.js +23 -0
  48. package/src/components/Organisms/DonateBanner/dev-data/data-single.js +23 -0
  49. package/src/components/Organisms/DonateBanner/dev-data/data.js +41 -0
  50. package/src/index.js +1 -0
@@ -32,7 +32,7 @@ exports[`renders correctly with data prop 1`] = `
32
32
  object-fit: cover;
33
33
  }
34
34
 
35
- .c18 {
35
+ .c19 {
36
36
  display: inline-block;
37
37
  color: #FFFFFF;
38
38
  fill: currentColor;
@@ -85,7 +85,7 @@ exports[`renders correctly with data prop 1`] = `
85
85
  pointer-events: none;
86
86
  }
87
87
 
88
- .c17 {
88
+ .c18 {
89
89
  width: 32px;
90
90
  height: 32px;
91
91
  border-radius: 50%;
@@ -107,6 +107,22 @@ exports[`renders correctly with data prop 1`] = `
107
107
  flex-shrink: 0;
108
108
  }
109
109
 
110
+ .c17 {
111
+ padding-left: 1rem;
112
+ display: -webkit-box;
113
+ display: -webkit-flex;
114
+ display: -ms-flexbox;
115
+ display: flex;
116
+ -webkit-align-items: center;
117
+ -webkit-box-align: center;
118
+ -ms-flex-align: center;
119
+ align-items: center;
120
+ -webkit-box-pack: end;
121
+ -webkit-justify-content: flex-end;
122
+ -ms-flex-pack: end;
123
+ justify-content: flex-end;
124
+ }
125
+
110
126
  .c3 {
111
127
  display: -webkit-box;
112
128
  display: -webkit-flex;
@@ -305,7 +321,7 @@ exports[`renders correctly with data prop 1`] = `
305
321
  }
306
322
 
307
323
  @media (min-width:1024px) {
308
- .c17 {
324
+ .c18 {
309
325
  background: #222222;
310
326
  }
311
327
  }
@@ -500,19 +516,23 @@ exports[`renders correctly with data prop 1`] = `
500
516
  <div
501
517
  className="c17"
502
518
  >
503
- <svg
519
+ <div
504
520
  className="c18"
505
- fill="none"
506
- height="13"
507
- viewBox="0 0 15 13"
508
- width="15"
509
- xmlns="http://www.w3.org/2000/svg"
510
521
  >
511
- <path
512
- d="M9.58496 0.349976C9.1395 -0.116662 8.40641 -0.116634 7.96094 0.349976C7.52803 0.803486 7.5281 1.53021 7.96094 1.98376L11.1582 5.33337H1.13672C0.48748 5.33337 0 5.87822 0 6.50037C2.15408e-05 7.1225 0.487494 7.66736 1.13672 7.66736H11.1582L7.96094 11.017C7.52806 11.4705 7.52899 12.1972 7.96191 12.6508C8.18163 12.8803 8.47556 13.0004 8.77344 13.0004C9.07114 13.0002 9.36533 12.8808 9.58496 12.6508L14.6758 7.31677L14.6748 7.3158L14.6875 7.3031L14.6865 7.30212C14.6954 7.29215 14.7044 7.28482 14.71 7.27771C14.7117 7.27545 14.7133 7.27285 14.7148 7.27087C14.7485 7.23203 14.7824 7.18925 14.8135 7.14099L14.8154 7.13806C14.8354 7.10658 14.8493 7.07842 14.8564 7.06384L14.8652 7.04626L14.8662 7.04431L14.8672 7.04333C14.8672 7.04333 14.868 7.04057 14.8691 7.03845C14.8709 7.03512 14.8758 7.02671 14.8799 7.01892L14.8802 7.01839C14.8888 7.002 14.9034 6.97423 14.917 6.93982V6.93787C14.9303 6.90375 14.9391 6.87285 14.9443 6.85388C14.9469 6.84458 14.9498 6.83567 14.9512 6.83044C14.9527 6.82454 14.9535 6.8228 14.9541 6.82068C14.9541 6.82068 14.9542 6.81753 14.9551 6.81482L14.958 6.80603L14.9586 6.80422C14.9631 6.78961 14.9718 6.76119 14.9785 6.72693V6.72498C15.0066 6.57705 15.0066 6.4246 14.9785 6.27673V6.27478L14.958 6.19568L14.9551 6.18591L14.9531 6.18005L14.9512 6.17224C14.9497 6.1664 14.9481 6.15677 14.9453 6.14685C14.9398 6.12695 14.9307 6.09654 14.917 6.06189C14.9032 6.02688 14.8885 5.99813 14.8799 5.98181C14.8758 5.97402 14.8709 5.96562 14.8691 5.96228L14.8564 5.93689C14.849 5.92177 14.8351 5.89372 14.8154 5.86267L14.8145 5.86072L14.7529 5.7738C14.7316 5.74659 14.7094 5.72129 14.6875 5.69763C14.6837 5.69341 14.6802 5.68854 14.6758 5.68396L9.58496 0.349976Z"
513
- fill="currentColor"
514
- />
515
- </svg>
522
+ <svg
523
+ className="c19"
524
+ fill="none"
525
+ height="13"
526
+ viewBox="0 0 15 13"
527
+ width="15"
528
+ xmlns="http://www.w3.org/2000/svg"
529
+ >
530
+ <path
531
+ d="M9.58496 0.349976C9.1395 -0.116662 8.40641 -0.116634 7.96094 0.349976C7.52803 0.803486 7.5281 1.53021 7.96094 1.98376L11.1582 5.33337H1.13672C0.48748 5.33337 0 5.87822 0 6.50037C2.15408e-05 7.1225 0.487494 7.66736 1.13672 7.66736H11.1582L7.96094 11.017C7.52806 11.4705 7.52899 12.1972 7.96191 12.6508C8.18163 12.8803 8.47556 13.0004 8.77344 13.0004C9.07114 13.0002 9.36533 12.8808 9.58496 12.6508L14.6758 7.31677L14.6748 7.3158L14.6875 7.3031L14.6865 7.30212C14.6954 7.29215 14.7044 7.28482 14.71 7.27771C14.7117 7.27545 14.7133 7.27285 14.7148 7.27087C14.7485 7.23203 14.7824 7.18925 14.8135 7.14099L14.8154 7.13806C14.8354 7.10658 14.8493 7.07842 14.8564 7.06384L14.8652 7.04626L14.8662 7.04431L14.8672 7.04333C14.8672 7.04333 14.868 7.04057 14.8691 7.03845C14.8709 7.03512 14.8758 7.02671 14.8799 7.01892L14.8802 7.01839C14.8888 7.002 14.9034 6.97423 14.917 6.93982V6.93787C14.9303 6.90375 14.9391 6.87285 14.9443 6.85388C14.9469 6.84458 14.9498 6.83567 14.9512 6.83044C14.9527 6.82454 14.9535 6.8228 14.9541 6.82068C14.9541 6.82068 14.9542 6.81753 14.9551 6.81482L14.958 6.80603L14.9586 6.80422C14.9631 6.78961 14.9718 6.76119 14.9785 6.72693V6.72498C15.0066 6.57705 15.0066 6.4246 14.9785 6.27673V6.27478L14.958 6.19568L14.9551 6.18591L14.9531 6.18005L14.9512 6.17224C14.9497 6.1664 14.9481 6.15677 14.9453 6.14685C14.9398 6.12695 14.9307 6.09654 14.917 6.06189C14.9032 6.02688 14.8885 5.99813 14.8799 5.98181C14.8758 5.97402 14.8709 5.96562 14.8691 5.96228L14.8564 5.93689C14.849 5.92177 14.8351 5.89372 14.8154 5.86267L14.8145 5.86072L14.7529 5.7738C14.7316 5.74659 14.7094 5.72129 14.6875 5.69763C14.6837 5.69341 14.6802 5.68854 14.6758 5.68396L9.58496 0.349976Z"
532
+ fill="currentColor"
533
+ />
534
+ </svg>
535
+ </div>
516
536
  </div>
517
537
  </div>
518
538
  </div>
@@ -540,7 +560,7 @@ exports[`renders correctly without image 1`] = `
540
560
  line-height: inherit;
541
561
  }
542
562
 
543
- .c14 {
563
+ .c15 {
544
564
  display: inline-block;
545
565
  color: #FFFFFF;
546
566
  fill: currentColor;
@@ -576,7 +596,7 @@ exports[`renders correctly without image 1`] = `
576
596
  pointer-events: none;
577
597
  }
578
598
 
579
- .c13 {
599
+ .c14 {
580
600
  width: 32px;
581
601
  height: 32px;
582
602
  border-radius: 50%;
@@ -598,6 +618,22 @@ exports[`renders correctly without image 1`] = `
598
618
  flex-shrink: 0;
599
619
  }
600
620
 
621
+ .c13 {
622
+ padding-left: 1rem;
623
+ display: -webkit-box;
624
+ display: -webkit-flex;
625
+ display: -ms-flexbox;
626
+ display: flex;
627
+ -webkit-align-items: center;
628
+ -webkit-box-align: center;
629
+ -ms-flex-align: center;
630
+ align-items: center;
631
+ -webkit-box-pack: end;
632
+ -webkit-justify-content: flex-end;
633
+ -ms-flex-pack: end;
634
+ justify-content: flex-end;
635
+ }
636
+
601
637
  .c3 {
602
638
  display: -webkit-box;
603
639
  display: -webkit-flex;
@@ -758,7 +794,7 @@ exports[`renders correctly without image 1`] = `
758
794
  }
759
795
 
760
796
  @media (min-width:1024px) {
761
- .c13 {
797
+ .c14 {
762
798
  background: #222222;
763
799
  }
764
800
  }
@@ -922,19 +958,23 @@ exports[`renders correctly without image 1`] = `
922
958
  <div
923
959
  className="c13"
924
960
  >
925
- <svg
961
+ <div
926
962
  className="c14"
927
- fill="none"
928
- height="13"
929
- viewBox="0 0 15 13"
930
- width="15"
931
- xmlns="http://www.w3.org/2000/svg"
932
963
  >
933
- <path
934
- d="M9.58496 0.349976C9.1395 -0.116662 8.40641 -0.116634 7.96094 0.349976C7.52803 0.803486 7.5281 1.53021 7.96094 1.98376L11.1582 5.33337H1.13672C0.48748 5.33337 0 5.87822 0 6.50037C2.15408e-05 7.1225 0.487494 7.66736 1.13672 7.66736H11.1582L7.96094 11.017C7.52806 11.4705 7.52899 12.1972 7.96191 12.6508C8.18163 12.8803 8.47556 13.0004 8.77344 13.0004C9.07114 13.0002 9.36533 12.8808 9.58496 12.6508L14.6758 7.31677L14.6748 7.3158L14.6875 7.3031L14.6865 7.30212C14.6954 7.29215 14.7044 7.28482 14.71 7.27771C14.7117 7.27545 14.7133 7.27285 14.7148 7.27087C14.7485 7.23203 14.7824 7.18925 14.8135 7.14099L14.8154 7.13806C14.8354 7.10658 14.8493 7.07842 14.8564 7.06384L14.8652 7.04626L14.8662 7.04431L14.8672 7.04333C14.8672 7.04333 14.868 7.04057 14.8691 7.03845C14.8709 7.03512 14.8758 7.02671 14.8799 7.01892L14.8802 7.01839C14.8888 7.002 14.9034 6.97423 14.917 6.93982V6.93787C14.9303 6.90375 14.9391 6.87285 14.9443 6.85388C14.9469 6.84458 14.9498 6.83567 14.9512 6.83044C14.9527 6.82454 14.9535 6.8228 14.9541 6.82068C14.9541 6.82068 14.9542 6.81753 14.9551 6.81482L14.958 6.80603L14.9586 6.80422C14.9631 6.78961 14.9718 6.76119 14.9785 6.72693V6.72498C15.0066 6.57705 15.0066 6.4246 14.9785 6.27673V6.27478L14.958 6.19568L14.9551 6.18591L14.9531 6.18005L14.9512 6.17224C14.9497 6.1664 14.9481 6.15677 14.9453 6.14685C14.9398 6.12695 14.9307 6.09654 14.917 6.06189C14.9032 6.02688 14.8885 5.99813 14.8799 5.98181C14.8758 5.97402 14.8709 5.96562 14.8691 5.96228L14.8564 5.93689C14.849 5.92177 14.8351 5.89372 14.8154 5.86267L14.8145 5.86072L14.7529 5.7738C14.7316 5.74659 14.7094 5.72129 14.6875 5.69763C14.6837 5.69341 14.6802 5.68854 14.6758 5.68396L9.58496 0.349976Z"
935
- fill="currentColor"
936
- />
937
- </svg>
964
+ <svg
965
+ className="c15"
966
+ fill="none"
967
+ height="13"
968
+ viewBox="0 0 15 13"
969
+ width="15"
970
+ xmlns="http://www.w3.org/2000/svg"
971
+ >
972
+ <path
973
+ d="M9.58496 0.349976C9.1395 -0.116662 8.40641 -0.116634 7.96094 0.349976C7.52803 0.803486 7.5281 1.53021 7.96094 1.98376L11.1582 5.33337H1.13672C0.48748 5.33337 0 5.87822 0 6.50037C2.15408e-05 7.1225 0.487494 7.66736 1.13672 7.66736H11.1582L7.96094 11.017C7.52806 11.4705 7.52899 12.1972 7.96191 12.6508C8.18163 12.8803 8.47556 13.0004 8.77344 13.0004C9.07114 13.0002 9.36533 12.8808 9.58496 12.6508L14.6758 7.31677L14.6748 7.3158L14.6875 7.3031L14.6865 7.30212C14.6954 7.29215 14.7044 7.28482 14.71 7.27771C14.7117 7.27545 14.7133 7.27285 14.7148 7.27087C14.7485 7.23203 14.7824 7.18925 14.8135 7.14099L14.8154 7.13806C14.8354 7.10658 14.8493 7.07842 14.8564 7.06384L14.8652 7.04626L14.8662 7.04431L14.8672 7.04333C14.8672 7.04333 14.868 7.04057 14.8691 7.03845C14.8709 7.03512 14.8758 7.02671 14.8799 7.01892L14.8802 7.01839C14.8888 7.002 14.9034 6.97423 14.917 6.93982V6.93787C14.9303 6.90375 14.9391 6.87285 14.9443 6.85388C14.9469 6.84458 14.9498 6.83567 14.9512 6.83044C14.9527 6.82454 14.9535 6.8228 14.9541 6.82068C14.9541 6.82068 14.9542 6.81753 14.9551 6.81482L14.958 6.80603L14.9586 6.80422C14.9631 6.78961 14.9718 6.76119 14.9785 6.72693V6.72498C15.0066 6.57705 15.0066 6.4246 14.9785 6.27673V6.27478L14.958 6.19568L14.9551 6.18591L14.9531 6.18005L14.9512 6.17224C14.9497 6.1664 14.9481 6.15677 14.9453 6.14685C14.9398 6.12695 14.9307 6.09654 14.917 6.06189C14.9032 6.02688 14.8885 5.99813 14.8799 5.98181C14.8758 5.97402 14.8709 5.96562 14.8691 5.96228L14.8564 5.93689C14.849 5.92177 14.8351 5.89372 14.8154 5.86267L14.8145 5.86072L14.7529 5.7738C14.7316 5.74659 14.7094 5.72129 14.6875 5.69763C14.6837 5.69341 14.6802 5.68854 14.6758 5.68396L9.58496 0.349976Z"
974
+ fill="currentColor"
975
+ />
976
+ </svg>
977
+ </div>
938
978
  </div>
939
979
  </div>
940
980
  </div>
@@ -12,6 +12,7 @@ import {
12
12
  CTA,
13
13
  CTAText,
14
14
  CTATextUnderline,
15
+ ArrowIconOuter,
15
16
  ArrowIconWrapper,
16
17
  CardWrapper
17
18
  } from './CTACard.style';
@@ -88,9 +89,11 @@ const CTACard = ({
88
89
  aria-hidden="true"
89
90
  />
90
91
  </CTAText>
91
- <ArrowIconWrapper>
92
- <ArrowIcon />
93
- </ArrowIconWrapper>
92
+ <ArrowIconOuter>
93
+ <ArrowIconWrapper>
94
+ <ArrowIcon />
95
+ </ArrowIconWrapper>
96
+ </ArrowIconOuter>
94
97
  </CTA>
95
98
  )}
96
99
  </CopyAndLinkSection>
@@ -88,6 +88,13 @@ const ArrowIconWrapper = styled.div`
88
88
  flex-shrink: 0;
89
89
  `;
90
90
 
91
+ const ArrowIconOuter = styled.div`
92
+ padding-left: 1rem;
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: flex-end;
96
+ `;
97
+
91
98
  // Card wrapper link - makes entire card clickable
92
99
  const CardLink = styled.a`
93
100
  display: flex;
@@ -316,6 +323,7 @@ export {
316
323
  CTA,
317
324
  CTAText,
318
325
  CTATextUnderline,
326
+ ArrowIconOuter,
319
327
  ArrowIconWrapper,
320
328
  CardWrapper
321
329
  };
@@ -8,6 +8,11 @@ import Picture from '../../Atoms/Picture/Picture';
8
8
  import Form from './Form/Form';
9
9
  import { handleTitles, handleCopy } from './_utils';
10
10
 
11
+ // NB this is now our 'old' Donate widget, which is being replaced by the DonateBanner component
12
+ // This component is now deprecated and will be removed in a future release.
13
+
14
+ // TODO: Remove this component in a future release.
15
+
11
16
  import {
12
17
  BgImage,
13
18
  Container,
@@ -45,7 +45,6 @@ const Signup = ({
45
45
  givingType = null,
46
46
  ...rest
47
47
  }) => {
48
- // const [givingType, setGivingType] = useState();
49
48
  const [errorMsg, setErrorMsg] = useState(false);
50
49
  const [amountDonate, setAmountDonate] = useState(10);
51
50
  const [moneyBuyCopy, setMoneyBuyCopy] = useState(true);
@@ -0,0 +1,210 @@
1
+ import React, { useState } from 'react';
2
+ import { useMediaQuery } from 'react-responsive';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import { breakpointValues } from '../../../theme/shared/allBreakpoints';
6
+ import Text from '../../Atoms/Text/Text';
7
+ import Picture from '../../Atoms/Picture/Picture';
8
+ import Form from './Form/Form';
9
+ import { handleTitles, handleOtherAmountText } from './_utils';
10
+
11
+ import {
12
+ BgImage,
13
+ Container,
14
+ InnerContainer,
15
+ TitleWrapperInner,
16
+ TitleWrapperOuter,
17
+ Wrapper
18
+ } from './DonateBanner.style';
19
+
20
+ const DonateBanner = ({
21
+ donateWidgetIsTextOnly = false,
22
+ donateOrientation = 'right',
23
+ paddingAbove = '2rem',
24
+ paddingBelow = '2rem',
25
+ pageBackgroundColour = 'transparent',
26
+ componentBackgroundColour = 'white',
27
+ title = null,
28
+ subtitle = '',
29
+ monthlyTitle = '',
30
+ monthlySubtitle = '',
31
+ popUpText = 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
32
+ chooseAmountText = null,
33
+ monthlyChooseAmountText = null,
34
+ otherAmountText = 'will help us fund amazing projects in the UK and around the world.',
35
+ monthlyOtherAmountText = '',
36
+ hideMoneyBuys = false,
37
+ imageL = null,
38
+ imageM = null,
39
+ imageS = null,
40
+ data = {},
41
+ cartID,
42
+ clientID,
43
+ donateLink,
44
+ mbshipID
45
+ }) => {
46
+ const isLarge = useMediaQuery({ query: `(min-width: ${breakpointValues.L}px)` });
47
+ const isMedium = useMediaQuery({ query: `(min-width: ${breakpointValues.M}px)` });
48
+ const [givingType, setGivingType] = useState();
49
+
50
+ const {
51
+ showCopy,
52
+ thisTitle,
53
+ thisSubtitle,
54
+ noTitlesAtAll
55
+ } = handleTitles(givingType, title, subtitle, monthlyTitle, monthlySubtitle);
56
+
57
+ const {
58
+ thisOtherAmountText
59
+ } = handleOtherAmountText(givingType, otherAmountText, monthlyOtherAmountText);
60
+
61
+ const shouldShowImage = donateWidgetIsTextOnly === false;
62
+
63
+ const shouldShowDesktopImage = shouldShowImage
64
+ && isLarge && imageL
65
+ && (imageL.images || imageL.image);
66
+
67
+ const shouldShowTopImage = shouldShowImage && !isLarge;
68
+ const topImage = isMedium ? imageM : imageS;
69
+
70
+ const shouldRenderTopImage = shouldShowTopImage
71
+ && topImage && (topImage.images || topImage.image);
72
+
73
+ // For text-only variants, we hide the title area on non-desktop widths
74
+ // (M and below), so only the form is shown.
75
+ const shouldShowTitleSection = noTitlesAtAll === false && isLarge && donateWidgetIsTextOnly;
76
+
77
+ return (
78
+ <Container
79
+ paddingAbove={paddingAbove}
80
+ paddingBelow={paddingBelow}
81
+ pageBackgroundColour={pageBackgroundColour}
82
+ id={mbshipID}
83
+ >
84
+ <InnerContainer
85
+ componentBackgroundColour={componentBackgroundColour}
86
+ $donateWidgetIsTextOnly={donateWidgetIsTextOnly}
87
+ >
88
+ {shouldRenderTopImage ? (
89
+ <Picture
90
+ image={topImage.image}
91
+ images={topImage.images}
92
+ imageLow={topImage.imageLow}
93
+ objectFit="cover"
94
+ width="100%"
95
+ height="100%"
96
+ alt={topImage.alt || ''}
97
+ // Force React to re-render with any updated image details
98
+ key={topImage.imageLow}
99
+ />
100
+ ) : null}
101
+
102
+ {shouldShowDesktopImage ? (
103
+ <BgImage
104
+ image={imageL.image}
105
+ images={imageL.images}
106
+ imageLow={imageL.imageLow}
107
+ objectFit="cover"
108
+ width="100%"
109
+ height="100%"
110
+ alt={imageL.alt || ''}
111
+ isBackgroundImage
112
+ />
113
+ ) : null}
114
+
115
+ <Wrapper
116
+ donateOrientation={donateOrientation}
117
+ aria-live="polite"
118
+ noTitlesAtAll={noTitlesAtAll}
119
+ hasTopImage={shouldRenderTopImage}
120
+ shouldShowTitleSection={shouldShowTitleSection}
121
+ >
122
+ {shouldShowTitleSection && (
123
+ <TitleWrapperOuter donateOrientation={donateOrientation}>
124
+ <TitleWrapperInner>
125
+ {showCopy && (
126
+ <>
127
+ <Text
128
+ tag="h2"
129
+ size="big"
130
+ family="Anton"
131
+ weight="normal"
132
+ >
133
+ {thisTitle}
134
+ </Text>
135
+ <Text tag="p" size="m">
136
+ {thisSubtitle}
137
+ </Text>
138
+ </>
139
+ )}
140
+ </TitleWrapperInner>
141
+ </TitleWrapperOuter>
142
+ )}
143
+
144
+ <Form
145
+ data={data}
146
+ otherAmountText={thisOtherAmountText}
147
+ cartID={cartID}
148
+ clientID={clientID}
149
+ mbshipID={mbshipID}
150
+ donateLink={donateLink}
151
+ hideMoneyBuys={hideMoneyBuys}
152
+ popUpText={popUpText}
153
+ chooseAmountText={chooseAmountText}
154
+ monthlyChooseAmountText={monthlyChooseAmountText}
155
+ donateWidgetIsTextOnly={donateWidgetIsTextOnly}
156
+ hasTopImage={shouldRenderTopImage}
157
+ shouldShowTitleSection={shouldShowTitleSection}
158
+ donateOrientation={donateOrientation}
159
+ givingType={givingType}
160
+ changeGivingType={setGivingType}
161
+ />
162
+ </Wrapper>
163
+ </InnerContainer>
164
+ </Container>
165
+ );
166
+ };
167
+
168
+ DonateBanner.propTypes = {
169
+ donateWidgetIsTextOnly: PropTypes.bool,
170
+ donateOrientation: PropTypes.oneOf(['left', 'right']),
171
+ paddingAbove: PropTypes.string,
172
+ paddingBelow: PropTypes.string,
173
+ pageBackgroundColour: PropTypes.string,
174
+ componentBackgroundColour: PropTypes.string,
175
+ title: PropTypes.string,
176
+ subtitle: PropTypes.string,
177
+ monthlyTitle: PropTypes.string,
178
+ monthlySubtitle: PropTypes.string,
179
+ popUpText: PropTypes.string,
180
+ chooseAmountText: PropTypes.string,
181
+ monthlyChooseAmountText: PropTypes.string,
182
+ otherAmountText: PropTypes.string,
183
+ monthlyOtherAmountText: PropTypes.string,
184
+ hideMoneyBuys: PropTypes.bool,
185
+ imageL: PropTypes.shape({
186
+ images: PropTypes.string,
187
+ imageLow: PropTypes.string,
188
+ image: PropTypes.string,
189
+ alt: PropTypes.string
190
+ }),
191
+ imageM: PropTypes.shape({
192
+ images: PropTypes.string,
193
+ imageLow: PropTypes.string,
194
+ image: PropTypes.string,
195
+ alt: PropTypes.string
196
+ }),
197
+ imageS: PropTypes.shape({
198
+ images: PropTypes.string,
199
+ imageLow: PropTypes.string,
200
+ image: PropTypes.string,
201
+ alt: PropTypes.string
202
+ }),
203
+ data: PropTypes.objectOf(PropTypes.shape),
204
+ cartID: PropTypes.string.isRequired,
205
+ clientID: PropTypes.string.isRequired,
206
+ donateLink: PropTypes.string.isRequired,
207
+ mbshipID: PropTypes.string.isRequired
208
+ };
209
+
210
+ export default DonateBanner;
@@ -0,0 +1,168 @@
1
+ # DonateBanner
2
+
3
+ ## Image banner (widget right), custom padding + background
4
+
5
+ ```js
6
+ import data from './dev-data/data';
7
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
8
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
9
+
10
+ const imageL = {
11
+ images: desktopPictures.images,
12
+ imageLow: desktopPictures.imageLow,
13
+ alt: 'Background image'
14
+ };
15
+
16
+ const imageM = {
17
+ images: desktopPictures.images,
18
+ imageLow: desktopPictures.imageLow,
19
+ alt: 'Background image'
20
+ };
21
+
22
+ const imageS = {
23
+ images: mobilePictures.images,
24
+ imageLow: mobilePictures.imageLow,
25
+ alt: 'Background image'
26
+ };
27
+
28
+ <DonateBanner
29
+ pageBackgroundColour="grey_light"
30
+ paddingAbove="0rem"
31
+ paddingBelow="2rem"
32
+ donateOrientation="right"
33
+ imageL={imageL}
34
+ imageM={imageM}
35
+ imageS={imageS}
36
+ data={data}
37
+ mbshipID="mbship-1"
38
+ donateLink="https://donation.comicrelief.com/"
39
+ clientID="donate"
40
+ cartID="default-comicrelief"
41
+ title="Donate Now"
42
+ subtitle="Please help us fund life-changing projects in the UK and around the world."
43
+ />;
44
+ ```
45
+
46
+ ## Image banner (widget left), monthly title/subtitle + choose amount text overrides
47
+
48
+ ```js
49
+ import data from './dev-data/data';
50
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
51
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
52
+
53
+ const imageL = {
54
+ images: desktopPictures.images,
55
+ imageLow: desktopPictures.imageLow,
56
+ alt: 'Background image'
57
+ };
58
+
59
+ const imageM = {
60
+ images: desktopPictures.images,
61
+ imageLow: desktopPictures.imageLow,
62
+ alt: 'Background image'
63
+ };
64
+
65
+ const imageS = {
66
+ images: mobilePictures.images,
67
+ imageLow: mobilePictures.imageLow,
68
+ alt: 'Background image'
69
+ };
70
+
71
+ <DonateBanner
72
+ pageBackgroundColour="grey_light"
73
+ paddingAbove="2rem"
74
+ paddingBelow="2rem"
75
+ donateOrientation="left"
76
+ imageL={imageL}
77
+ imageM={imageM}
78
+ imageS={imageS}
79
+ data={data}
80
+ mbshipID="mbship-2"
81
+ donateLink="https://donation.comicrelief.com/"
82
+ clientID="donate"
83
+ cartID="default-comicrelief"
84
+ title="Donate today"
85
+ subtitle="Your support can help people facing the toughest times."
86
+ monthlyTitle="Give monthly"
87
+ monthlySubtitle="A regular gift helps fund long-term impact."
88
+ chooseAmountText="Choose a one-off amount"
89
+ monthlyChooseAmountText="Choose a monthly amount"
90
+ popUpText="Switching to a single gift means less predictable funding."
91
+ />;
92
+ ```
93
+
94
+ ## Text-only widget (no image), custom widget background + text colour
95
+
96
+ ```js
97
+ import data from './dev-data/data-single';
98
+
99
+ <DonateBanner
100
+ donateWidgetIsTextOnly
101
+ pageBackgroundColour="rnd_25_glitzy_grape"
102
+ componentBackgroundColour="deep_violet_dark"
103
+ paddingAbove="2rem"
104
+ paddingBelow="2rem"
105
+ donateOrientation="right"
106
+ data={data}
107
+ mbshipID="mbship-3"
108
+ donateLink="https://donation.comicrelief.com/"
109
+ clientID="donate"
110
+ cartID="default-comicrelief"
111
+ title="Donate now"
112
+ subtitle="Make a difference today."
113
+ chooseAmountText="Enter an amount to give"
114
+ noMoneyBuys
115
+ />;
116
+ ```
117
+
118
+ ## Text-only widget (no image), with the usual moneybuys, standard colours
119
+
120
+ ```js
121
+ import data from './dev-data/data';
122
+
123
+ <DonateBanner
124
+ donateWidgetIsTextOnly
125
+ pageBackgroundColour="grey_light"
126
+ componentBackgroundColour="white"
127
+ paddingAbove="2rem"
128
+ paddingBelow="2rem"
129
+ donateOrientation="right"
130
+ data={data}
131
+ mbshipID="mbship-3b"
132
+ donateLink="https://donation.comicrelief.com/"
133
+ clientID="donate"
134
+ cartID="default-comicrelief"
135
+ title="Donate now"
136
+ subtitle="Choose an amount or pick a moneybuy."
137
+ />;
138
+ ```
139
+
140
+ ## Different “Other amount” copy for single vs monthly
141
+
142
+ ```js
143
+ import data from './dev-data/data';
144
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
145
+
146
+ const imageL = {
147
+ images: desktopPictures.images,
148
+ imageLow: desktopPictures.imageLow,
149
+ alt: 'Background image'
150
+ };
151
+
152
+ <DonateBanner
153
+ pageBackgroundColour="grey_light"
154
+ paddingAbove="0rem"
155
+ paddingBelow="0rem"
156
+ donateOrientation="left"
157
+ imageL={imageL}
158
+ data={data}
159
+ mbshipID="mbship-4"
160
+ donateLink="https://donation.comicrelief.com/"
161
+ clientID="donate"
162
+ cartID="default-comicrelief"
163
+ title="Donate now"
164
+ subtitle="Help fund life-changing work."
165
+ otherAmountText="can help support people in crisis."
166
+ monthlyOtherAmountText="each month can help provide long-term support."
167
+ />;
168
+ ```