@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,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleTitles = exports.handleOtherAmountText = void 0;
7
+ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
8
+ let thisTitle;
9
+ let thisSubtitle;
10
+ const showSingleCopy = Boolean(subtitle) && Boolean(title);
11
+ const showMonthlyCopy = givingType === 'monthly' && Boolean(monthlySubtitle) && Boolean(monthlyTitle);
12
+ // Overall flag as to whether we render copy for the currently selected givingType
13
+ const showCopy = showMonthlyCopy || showSingleCopy;
14
+
15
+ // Acts as a flag to centre the form when no copy is supplied *at all*
16
+ const noTitlesAtAll = showSingleCopy === false && showMonthlyCopy === false;
17
+
18
+ // Apply the override if we've got monthly content AND giving type:
19
+ if (showMonthlyCopy) {
20
+ thisTitle = monthlyTitle;
21
+ thisSubtitle = monthlySubtitle;
22
+ } else if (showCopy) {
23
+ // Else, fall back to the default, after checking it's appropriate
24
+ thisTitle = title;
25
+ thisSubtitle = subtitle;
26
+ }
27
+ return {
28
+ showCopy,
29
+ thisTitle,
30
+ thisSubtitle,
31
+ noTitlesAtAll
32
+ };
33
+ };
34
+ exports.handleTitles = handleTitles;
35
+ const handleOtherAmountText = (givingType, otherAmountText, monthlyOtherAmountText) => {
36
+ const thisOtherAmountText = givingType === 'monthly' && Boolean(monthlyOtherAmountText) ? monthlyOtherAmountText : otherAmountText;
37
+ return {
38
+ thisOtherAmountText
39
+ };
40
+ };
41
+ exports.handleOtherAmountText = 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,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ cartId: '1-4-the-high-rollers',
9
+ singleGiving: {
10
+ moneybuys: [{
11
+ description: 'a pregnant woman in Uganda to have access to a birth kit so she can have a clean, safe delivery.',
12
+ value: 7777
13
+ }, {
14
+ description: 'a support worker to visit 10 isolated young mums with postnatal depression in the UK.',
15
+ value: 8888
16
+ }, {
17
+ description: 'clothes for a child who has had to leave their possessions behind while escaping domestic abuse.',
18
+ value: 9999
19
+ }]
20
+ },
21
+ regularGiving: {
22
+ moneybuys: [{
23
+ description: 'a regular supply of toiletries for someone living in a refugee camp in Serbia.',
24
+ value: 1111
25
+ }, {
26
+ description: 'a potentially lifesaving call for a man at risk of suicide in the UK.',
27
+ value: 2222
28
+ }, {
29
+ description: 'the distribution of enough surplus food for a school breakfast club to feed 80 children.',
30
+ value: 3333
31
+ }]
32
+ }
33
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ cartId: 'monthly-only',
9
+ singleGiving: null,
10
+ regularGiving: {
11
+ moneybuys: [{
12
+ description: 'a regular supply of toiletries for someone living in a refugee camp in Serbia.',
13
+ value: '5.50'
14
+ }, {
15
+ description: 'a potentially lifesaving call for a man at risk of suicide in the UK.',
16
+ value: '10'
17
+ }, {
18
+ description: 'the distribution of enough surplus food for a school breakfast club to feed 80 children.',
19
+ value: '20'
20
+ }]
21
+ }
22
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ cartId: 'test-sept2019-C365',
9
+ singleGiving: {
10
+ moneybuys: [{
11
+ description: 'a pregnant woman in Uganda to have access to a birth kit so she can have a clean, safe delivery.',
12
+ value: 10
13
+ }, {
14
+ description: 'a support worker to visit 10 isolated young mums with postnatal depression in the UK.',
15
+ value: 20
16
+ }, {
17
+ description: 'clothes for a child who has had to leave their possessions behind while escaping domestic abuse.',
18
+ value: 30
19
+ }]
20
+ },
21
+ regularGiving: null
22
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ cartId: 'test-sept2019-C365',
9
+ singleGiving: {
10
+ moneybuys: [{
11
+ description: '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',
12
+ value: '12.10'
13
+ }, {
14
+ description: 'could fund a specialist therapy session for a young person who has experienced or is at risk of homelessness',
15
+ value: '50'
16
+ }, {
17
+ description: '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
+ regularGiving: {
22
+ moneybuys: [{
23
+ description: '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',
24
+ value: '5'
25
+ }, {
26
+ description: 'a month could buy phone credit for a refugee in the UK to stay in touch with loved ones',
27
+ value: '10'
28
+ }, {
29
+ description: 'a month could help run parent support groups in Kenya that tackle stigma, ensuring children with a disability aren’t excluded from school',
30
+ value: '25'
31
+ }]
32
+ }
33
+ };
package/dist/index.js CHANGED
@@ -106,6 +106,12 @@ Object.defineProperty(exports, "Donate", {
106
106
  return _Donate.default;
107
107
  }
108
108
  });
109
+ Object.defineProperty(exports, "DonateBanner", {
110
+ enumerable: true,
111
+ get: function () {
112
+ return _DonateBanner.default;
113
+ }
114
+ });
109
115
  Object.defineProperty(exports, "DoubleCopy", {
110
116
  enumerable: true,
111
117
  get: function () {
@@ -494,6 +500,7 @@ var _ArticleTeaser = _interopRequireDefault(require("./components/Molecules/Arti
494
500
  var _Header = _interopRequireDefault(require("./components/Organisms/Header/Header"));
495
501
  var _Header2 = _interopRequireDefault(require("./components/Organisms/Header2025/Header2025"));
496
502
  var _Donate = _interopRequireDefault(require("./components/Organisms/Donate/Donate"));
503
+ var _DonateBanner = _interopRequireDefault(require("./components/Organisms/DonateBanner/DonateBanner"));
497
504
  var _DoubleCopy = _interopRequireDefault(require("./components/Molecules/DoubleCopy/DoubleCopy"));
498
505
  var _PartnerLink = _interopRequireDefault(require("./components/Molecules/PartnerLink/PartnerLink"));
499
506
  var _Footer = _interopRequireDefault(require("./components/Organisms/Footer/Footer"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "8.52.2",
4
+ "version": "8.53.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -45,6 +45,7 @@ const cardsFour = [
45
45
  ...cardsWithRenderedBody[0],
46
46
  id: 'example-4th-card',
47
47
  title: 'Fourth card',
48
+ linkLabel: "quite a long link label text here long text isn't it",
48
49
  body: (
49
50
  <Text tag="p">
50
51
  Fourth card (added for layout testing)