@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
@@ -0,0 +1,34 @@
1
+ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
2
+ let thisTitle; let thisSubtitle;
3
+ const showSingleCopy = Boolean(subtitle) && Boolean(title);
4
+ const showMonthlyCopy = givingType === 'monthly' && Boolean(monthlySubtitle) && Boolean(monthlyTitle);
5
+ // Overall flag as to whether we render copy for the currently selected givingType
6
+ const showCopy = showMonthlyCopy || showSingleCopy;
7
+
8
+ // Acts as a flag to centre the form when no copy is supplied *at all*
9
+ const noTitlesAtAll = showSingleCopy === false && showMonthlyCopy === false;
10
+
11
+ // Apply the override if we've got monthly content AND giving type:
12
+ if (showMonthlyCopy) {
13
+ thisTitle = monthlyTitle;
14
+ thisSubtitle = monthlySubtitle;
15
+ } else if (showCopy) {
16
+ // Else, fall back to the default, after checking it's appropriate
17
+ thisTitle = title;
18
+ thisSubtitle = subtitle;
19
+ }
20
+
21
+ return {
22
+ showCopy, thisTitle, thisSubtitle, noTitlesAtAll
23
+ };
24
+ };
25
+
26
+ const handleOtherAmountText = (givingType, otherAmountText, monthlyOtherAmountText) => {
27
+ const thisOtherAmountText = givingType === 'monthly' && Boolean(monthlyOtherAmountText)
28
+ ? monthlyOtherAmountText
29
+ : otherAmountText;
30
+
31
+ return { thisOtherAmountText };
32
+ };
33
+
34
+ export { handleTitles, handleOtherAmountText };
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5.70694 4.99994L9.85344 0.853438C10.0487 0.658188 10.0487 0.341688 9.85344 0.146437C9.65819 -0.0488125 9.34169 -0.0488125 9.14644 0.146437L4.99994 4.29294L0.853438 0.146437C0.658188 -0.0488125 0.341688 -0.0488125 0.146437 0.146437C-0.0488125 0.341688 -0.0488125 0.658188 0.146437 0.853438L4.29294 4.99994L0.146437 9.14644C-0.0488125 9.34169 -0.0488125 9.65819 0.146437 9.85344C0.244188 9.95119 0.371938 9.99994 0.499938 9.99994C0.627937 9.99994 0.755688 9.95119 0.853438 9.85344L4.99994 5.70694L9.14644 9.85344C9.24419 9.95119 9.37194 9.99994 9.49994 9.99994C9.62794 9.99994 9.75569 9.95119 9.85344 9.85344C10.0487 9.65819 10.0487 9.34169 9.85344 9.14644L5.70694 4.99994Z" fill="#222222"/>
3
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default {
2
+ cartId: '1-4-the-high-rollers',
3
+ singleGiving: {
4
+ moneybuys: [
5
+ {
6
+ description:
7
+ 'a pregnant woman in Uganda to have access to a birth kit so she can have a clean, safe delivery.',
8
+ value: 7777
9
+ },
10
+ {
11
+ description:
12
+ 'a support worker to visit 10 isolated young mums with postnatal depression in the UK.',
13
+ value: 8888
14
+ },
15
+ {
16
+ description:
17
+ 'clothes for a child who has had to leave their possessions behind while escaping domestic abuse.',
18
+ value: 9999
19
+ }
20
+ ]
21
+ },
22
+ regularGiving: {
23
+ moneybuys: [
24
+ {
25
+ description:
26
+ 'a regular supply of toiletries for someone living in a refugee camp in Serbia.',
27
+ value: 1111
28
+ },
29
+ {
30
+ description:
31
+ 'a potentially lifesaving call for a man at risk of suicide in the UK.',
32
+ value: 2222
33
+ },
34
+ {
35
+ description:
36
+ 'the distribution of enough surplus food for a school breakfast club to feed 80 children.',
37
+ value: 3333
38
+ }
39
+ ]
40
+ }
41
+ };
@@ -0,0 +1,23 @@
1
+ export default {
2
+ cartId: 'monthly-only',
3
+ singleGiving: null,
4
+ regularGiving: {
5
+ moneybuys: [
6
+ {
7
+ description:
8
+ 'a regular supply of toiletries for someone living in a refugee camp in Serbia.',
9
+ value: '5.50'
10
+ },
11
+ {
12
+ description:
13
+ 'a potentially lifesaving call for a man at risk of suicide in the UK.',
14
+ value: '10'
15
+ },
16
+ {
17
+ description:
18
+ 'the distribution of enough surplus food for a school breakfast club to feed 80 children.',
19
+ value: '20'
20
+ }
21
+ ]
22
+ }
23
+ };
@@ -0,0 +1,23 @@
1
+ export default {
2
+ cartId: 'test-sept2019-C365',
3
+ singleGiving: {
4
+ moneybuys: [
5
+ {
6
+ description:
7
+ 'a pregnant woman in Uganda to have access to a birth kit so she can have a clean, safe delivery.',
8
+ value: 10
9
+ },
10
+ {
11
+ description:
12
+ 'a support worker to visit 10 isolated young mums with postnatal depression in the UK.',
13
+ value: 20
14
+ },
15
+ {
16
+ description:
17
+ 'clothes for a child who has had to leave their possessions behind while escaping domestic abuse.',
18
+ value: 30
19
+ }
20
+ ]
21
+ },
22
+ regularGiving: null
23
+ };
@@ -0,0 +1,41 @@
1
+ export default {
2
+ cartId: 'test-sept2019-C365',
3
+ singleGiving: {
4
+ moneybuys: [
5
+ {
6
+ description:
7
+ 'could help pay for a child refugee to attend a youth group session to build language skills and feel less alone as they adapt to life in a new community',
8
+ value: '12.10'
9
+ },
10
+ {
11
+ description:
12
+ 'could fund a specialist therapy session for a young person who has experienced or is at risk of homelessness',
13
+ value: '50'
14
+ },
15
+ {
16
+ description:
17
+ 'could keep a food delivery van on the road for an entire day, delivering hundreds of meals to people in need',
18
+ value: '100'
19
+ }
20
+ ]
21
+ },
22
+ regularGiving: {
23
+ moneybuys: [
24
+ {
25
+ description:
26
+ 'a month could help pay for a vulnerable young person in the UK to go to an after-school club throughout the month, allowing them to socialise, build friendships, and improve mental wellbeing',
27
+ value: '5'
28
+ },
29
+ {
30
+ description:
31
+ 'a month could buy phone credit for a refugee in the UK to stay in touch with loved ones',
32
+ value: '10'
33
+ },
34
+ {
35
+ description:
36
+ 'a month could help run parent support groups in Kenya that tackle stigma, ensuring children with a disability aren’t excluded from school',
37
+ value: '25'
38
+ }
39
+ ]
40
+ }
41
+ };
package/src/index.js CHANGED
@@ -45,6 +45,7 @@ export { default as ArticleTeaser } from './components/Molecules/ArticleTeaser/A
45
45
  export { default as Header } from './components/Organisms/Header/Header';
46
46
  export { default as Header2025 } from './components/Organisms/Header2025/Header2025';
47
47
  export { default as Donate } from './components/Organisms/Donate/Donate';
48
+ export { default as DonateBanner } from './components/Organisms/DonateBanner/DonateBanner';
48
49
  export { default as DoubleCopy } from './components/Molecules/DoubleCopy/DoubleCopy';
49
50
  export { default as PartnerLink } from './components/Molecules/PartnerLink/PartnerLink';
50
51
  export { default as Footer } from './components/Organisms/Footer/Footer';