@comicrelief/component-library 7.27.0 → 7.29.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.
@@ -12,6 +12,7 @@ var _size = require("../../../theme/shared/size");
12
12
  var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
13
13
  var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
14
14
  var _Form = _interopRequireDefault(require("./Form/Form"));
15
+ var _utils = require("./_utils");
15
16
  var _Donate = require("./Donate.style");
16
17
  const Donate = _ref => {
17
18
  let {
@@ -43,7 +44,12 @@ const Donate = _ref => {
43
44
  otherAmountValue,
44
45
  additionalSingleCopy,
45
46
  additionalMonthlyCopy,
46
- defaultGivingType
47
+ defaultGivingType,
48
+ monthlyTitle,
49
+ monthlySubtitle,
50
+ // Just to keep the function call character length under control
51
+ monthlyChooseAmountText: monthlyChoose,
52
+ monthlyOtherAmountText: monthlyOther
47
53
  } = _ref;
48
54
  let isDesktop = (0, _reactResponsive.useMediaQuery)({
49
55
  query: "(min-width: ".concat(_size.screen.medium, ")")
@@ -51,6 +57,7 @@ const Donate = _ref => {
51
57
 
52
58
  // To let us store any updated override, and force a re-render
53
59
  const [overrideValue, setOverrideValue] = (0, _react.useState)(null);
60
+ const [givingType, setGivingType] = (0, _react.useState)();
54
61
 
55
62
  // Store the updated override value
56
63
  (0, _react.useEffect)(() => {
@@ -59,6 +66,17 @@ const Donate = _ref => {
59
66
 
60
67
  // If a boolean value has been passed, let it replace our 'internal' value
61
68
  isDesktop = overrideValue !== null ? overrideValue : isDesktop;
69
+
70
+ // Handy helper functions to process copy, based on givingType
71
+ const {
72
+ showCopy,
73
+ thisTitle,
74
+ thisSubtitle
75
+ } = (0, _utils.handleTitles)(givingType, title, subtitle, monthlyTitle, monthlySubtitle);
76
+ const {
77
+ thisOtherAmountText,
78
+ thisChooseAmountText
79
+ } = (0, _utils.handleCopy)(givingType, otherAmountText, chooseAmountText, monthlyOther, monthlyChoose);
62
80
  return /*#__PURE__*/_react.default.createElement(_Donate.Container, {
63
81
  mobileBackgroundColor: mobileBackgroundColor,
64
82
  desktopOverlayColor: desktopOverlayColor,
@@ -88,32 +106,34 @@ const Donate = _ref => {
88
106
  "aria-live": "polite"
89
107
  }, /*#__PURE__*/_react.default.createElement(_Donate.Header, {
90
108
  formAlignRight: formAlignRight
91
- }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, Boolean(subtitle) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Boolean(title) && /*#__PURE__*/_react.default.createElement(_Text.default, {
109
+ }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, showCopy && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
92
110
  tag: "h2",
93
111
  color: textColor,
94
112
  size: "big",
95
113
  family: "Anton",
96
114
  weight: "normal",
97
115
  uppercase: true
98
- }, title), /*#__PURE__*/_react.default.createElement(_Text.default, {
116
+ }, thisTitle), /*#__PURE__*/_react.default.createElement(_Text.default, {
99
117
  tag: "p",
100
118
  color: textColor,
101
119
  size: "m"
102
- }, subtitle)))), /*#__PURE__*/_react.default.createElement(_Form.default, {
120
+ }, thisSubtitle)))), /*#__PURE__*/_react.default.createElement(_Form.default, {
103
121
  data: data,
104
- otherAmountText: otherAmountText,
122
+ otherAmountText: thisOtherAmountText,
105
123
  cartID: cartID,
106
124
  clientID: clientID,
107
125
  mbshipID: mbshipID,
108
126
  donateLink: donateLink,
109
127
  noMoneyBuys: noMoneyBuys,
110
128
  PopUpText: PopUpText,
111
- chooseAmountText: chooseAmountText,
129
+ chooseAmountText: thisChooseAmountText,
112
130
  submitButtonColor: submitButtonColor,
113
131
  otherAmountValue: otherAmountValue,
114
132
  additionalSingleCopy: additionalSingleCopy,
115
133
  additionalMonthlyCopy: additionalMonthlyCopy,
116
- defaultGivingType: defaultGivingType
134
+ defaultGivingType: defaultGivingType,
135
+ givingType: givingType,
136
+ changeGivingType: setGivingType
117
137
  })));
118
138
  };
119
139
  Donate.defaultProps = {
@@ -142,6 +162,10 @@ Donate.defaultProps = {
142
162
  title: null,
143
163
  additionalSingleCopy: null,
144
164
  additionalMonthlyCopy: null,
145
- defaultGivingType: null
165
+ defaultGivingType: null,
166
+ monthlyTitle: null,
167
+ monthlySubtitle: null,
168
+ monthlyChooseAmountText: null,
169
+ monthlyOtherAmountText: null
146
170
  };
147
171
  var _default = exports.default = Donate;
@@ -513,7 +513,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
513
513
  mobileImageLow={mobilePictures.imageLow}
514
514
  mobileImages={mobilePictures.images}
515
515
  data={data}
516
- mbshipID="mship-15"
516
+ mbshipID="mship-16"
517
517
  donateLink="https://donation.comicrelief.com/"
518
518
  clientID="donate"
519
519
  cartID="default-comicrelief"
@@ -521,4 +521,99 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
521
521
  subtitle="Please help us fund life-changing projects in the UK and around the world."
522
522
  noMoneyBuys
523
523
  />;
524
+ ```
525
+
526
+ ## Monthly 'Choose Amount' and 'Other Amount' copy overrides
527
+
528
+ ```js
529
+ import data from './dev-data/data';
530
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
531
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
532
+
533
+ <Donate
534
+ alt="Background image"
535
+ mobileBackgroundColor="deep_violet_dark"
536
+ desktopOverlayColor="red"
537
+ submitButtonColor="blue_dark"
538
+ formAlignRight={true}
539
+ imageLow={desktopPictures.imageLow}
540
+ images={desktopPictures.images}
541
+ mobileImageLow={mobilePictures.imageLow}
542
+ mobileImages={mobilePictures.images}
543
+ data={data}
544
+ mbshipID="mship-17"
545
+ donateLink="https://donation.comicrelief.com/"
546
+ clientID="donate"
547
+ cartID="default-comicrelief"
548
+ title="Standard title here"
549
+ subtitle="Standard subtitle here"
550
+ otherAmountText="Here's an otherAmountText override"
551
+ chooseAmountText="Here's an chooseAmountText override"
552
+ monthlyChooseAmountText="monthlyChooseAmountText here"
553
+ monthlyOtherAmountText="monthlyOtherAmountText here"
554
+ />;
555
+ ```
556
+
557
+ ## Monthly Title and Subtitle overrides
558
+
559
+ ```js
560
+ import data from './dev-data/data';
561
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
562
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
563
+
564
+ <Donate
565
+ alt="Background image"
566
+ mobileBackgroundColor="deep_violet_dark"
567
+ desktopOverlayColor="red"
568
+ submitButtonColor="blue_dark"
569
+ formAlignRight={true}
570
+ imageLow={desktopPictures.imageLow}
571
+ images={desktopPictures.images}
572
+ mobileImageLow={mobilePictures.imageLow}
573
+ mobileImages={mobilePictures.images}
574
+ data={data}
575
+ mbshipID="mship-18"
576
+ donateLink="https://donation.comicrelief.com/"
577
+ clientID="donate"
578
+ cartID="default-comicrelief"
579
+ title="Standard title here"
580
+ subtitle="Standard subtitle here"
581
+ otherAmountText="Here's an otherAmountText override"
582
+ chooseAmountText="Here's an chooseAmountText override"
583
+ monthlyTitle="Monthly Title here"
584
+ monthlySubtitle="Monthly Subtitle here"
585
+ />;
586
+ ```
587
+
588
+ ## All monthly overrides
589
+
590
+ ```js
591
+ import data from './dev-data/data';
592
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
593
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
594
+
595
+ <Donate
596
+ alt="Background image"
597
+ mobileBackgroundColor="deep_violet_dark"
598
+ desktopOverlayColor="red"
599
+ submitButtonColor="blue_dark"
600
+ formAlignRight={true}
601
+ imageLow={desktopPictures.imageLow}
602
+ images={desktopPictures.images}
603
+ mobileImageLow={mobilePictures.imageLow}
604
+ mobileImages={mobilePictures.images}
605
+ data={data}
606
+ mbshipID="mship-19"
607
+ donateLink="https://donation.comicrelief.com/"
608
+ clientID="donate"
609
+ cartID="default-comicrelief"
610
+ title="Standard title here"
611
+ subtitle="Standard subtitle here"
612
+ otherAmountText="Here's an otherAmountText override"
613
+ chooseAmountText="Here's an chooseAmountText override"
614
+ monthlyTitle="Monthly Title here"
615
+ monthlySubtitle="Monthly Subtitle here"
616
+ monthlyChooseAmountText="monthlyChooseAmountText here"
617
+ monthlyOtherAmountText="monthlyOtherAmountText here"
618
+ />;
524
619
  ```
@@ -32,9 +32,13 @@ const Signup = _ref => {
32
32
  additionalSingleCopy,
33
33
  additionalMonthlyCopy,
34
34
  defaultGivingType,
35
+ monthlyChooseAmountCopy,
36
+ monthlyOtherAmountCopy,
37
+ changeGivingType,
38
+ givingType,
35
39
  ...rest
36
40
  } = _ref;
37
- const [givingType, setGivingType] = (0, _react.useState)();
41
+ // const [givingType, setGivingType] = useState();
38
42
  const [errorMsg, setErrorMsg] = (0, _react.useState)(false);
39
43
  const [amountDonate, setAmountDonate] = (0, _react.useState)(10);
40
44
  const [moneyBuyCopy, setMoneyBuyCopy] = (0, _react.useState)(true);
@@ -55,7 +59,9 @@ const Signup = _ref => {
55
59
  const thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
56
60
  setAmountDonate(thisAmount);
57
61
  }
58
- }, [givingType, singleGiving, regularGiving, otherAmountValue]);
62
+ // Pass givingType up to parent for copy-switching logic:
63
+ changeGivingType(givingType);
64
+ }, [givingType, singleGiving, regularGiving, otherAmountValue, changeGivingType]);
59
65
  (0, _react.useEffect)(() => {
60
66
  if (givingType) {
61
67
  const givingData = givingType === 'single' ? singleGiving : regularGiving;
@@ -84,13 +90,15 @@ const Signup = _ref => {
84
90
 
85
91
  // On load, determine what should actually be the default giving type
86
92
  (0, _react.useEffect)(() => {
93
+ let newGivingType;
87
94
  // Use any explicit setting
88
95
  if (defaultGivingType) {
89
- setGivingType(defaultGivingType);
96
+ newGivingType = defaultGivingType;
90
97
  } else {
91
98
  // Else, use whatever's available
92
- setGivingType(singleGiving !== null ? 'single' : 'monthly');
99
+ newGivingType = singleGiving !== null ? 'single' : 'monthly';
93
100
  }
101
+ changeGivingType(newGivingType);
94
102
  // eslint-disable-next-line react-hooks/exhaustive-deps
95
103
  }, []);
96
104
  const submitDonation = (event, amount, clientId, cartId, mbshipId, donateURL) => {
@@ -159,7 +167,7 @@ const Signup = _ref => {
159
167
  const additionalCopy = showAdditionalSingleCopy || showAdditionalMonthlyCopy;
160
168
  return /*#__PURE__*/_react.default.createElement(_Donate.FormWrapper, null, showGivingSelector && /*#__PURE__*/_react.default.createElement(_GivingSelector.default, {
161
169
  givingType: givingType,
162
- changeGivingType: data => setGivingType(data),
170
+ changeGivingType: data => changeGivingType(data),
163
171
  setPopOpen: setPopOpen,
164
172
  mbshipID: mbshipID
165
173
  }), popOpen && /*#__PURE__*/_react.default.createElement(_PopUpComponent.default, {
@@ -432,6 +432,10 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
432
432
  }
433
433
  }
434
434
 
435
+ @media (min-width:1024px) {
436
+
437
+ }
438
+
435
439
  @media (min-width:740px) {
436
440
  .c1 {
437
441
  padding: 4rem 1rem;
@@ -1718,6 +1722,14 @@ exports[`Single donation renders correctly 1`] = `
1718
1722
  }
1719
1723
  }
1720
1724
 
1725
+ @media (min-width:740px) {
1726
+
1727
+ }
1728
+
1729
+ @media (min-width:1024px) {
1730
+
1731
+ }
1732
+
1721
1733
  @media (min-width:1024px) {
1722
1734
  .c2 {
1723
1735
  width: 50%;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleTitles = exports.handleCopy = void 0;
7
+ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
8
+ let thisTitle;
9
+ let thisSubtitle;
10
+ const showMonthlyCopy = givingType === 'monthly' && Boolean(monthlySubtitle) && Boolean(monthlyTitle);
11
+ // Overall flag as to whether we render copy *at all*
12
+ const showCopy = showMonthlyCopy || Boolean(subtitle) && Boolean(title);
13
+
14
+ // Apply the override if we've got monthly content AND giving type:
15
+ if (showMonthlyCopy) {
16
+ thisTitle = monthlyTitle;
17
+ thisSubtitle = monthlyTitle;
18
+ } else if (showCopy) {
19
+ // Else, fall back to the default, after checking it's appropriate
20
+ thisTitle = title;
21
+ thisSubtitle = subtitle;
22
+ }
23
+ return {
24
+ showCopy,
25
+ thisTitle,
26
+ thisSubtitle
27
+ };
28
+ };
29
+ exports.handleTitles = handleTitles;
30
+ const handleCopy = (gType, otherAmount, chooseAmount, monthlyOtherAmount, monthlyChooseAmount) => {
31
+ // Only use any monthly overrides for the appropriate givingType
32
+ const thisOtherAmountText = gType === 'monthly' && Boolean(monthlyOtherAmount) ? monthlyOtherAmount : otherAmount;
33
+ const thisChooseAmountText = gType === 'monthly' && Boolean(monthlyChooseAmount) ? monthlyChooseAmount : chooseAmount;
34
+ return {
35
+ thisOtherAmountText,
36
+ thisChooseAmountText
37
+ };
38
+ };
39
+ exports.handleCopy = handleCopy;
@@ -116,6 +116,8 @@ import data from './data/data';
116
116
  import Link from '../../Atoms/Link/Link';
117
117
  import searchIcon from './assets/icon--search--2023.svg';
118
118
  import shopIcon from './assets/icon--shop--2023.svg';
119
+ import payinIcon from './assets/PayIn.svg';
120
+
119
121
  import Icon from '../../Atoms/SocialIcons/Icon/Icon';
120
122
  import RichText from '../../Atoms/RichText/RichText';
121
123
 
@@ -170,6 +172,17 @@ const [success, setSuccess] = React.useState(false);
170
172
  tabIndex="0"
171
173
  />
172
174
  </div>
175
+ <div>
176
+ <Icon
177
+ icon={payinIcon}
178
+ title="Payin"
179
+ target="_blank"
180
+ role="button"
181
+ href="https://donation.comicrelief.com/?cartId=rnd23-fundraisingpayin"
182
+ brand="comicrelief"
183
+ tabIndex="0"
184
+ />
185
+ </div>
173
186
  </>
174
187
  }
175
188
  />;
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M22 1H2C1.448 1 1 1.448 1 2V7C1 7.552 1.448 8 2 8H4V19V19.5V22C4 22.552 4.448 23 5 23H19C19.552 23 20 22.552 20 22V19.5V19V8H22C22.552 8 23 7.552 23 7V2C23 1.448 22.552 1 22 1ZM6 21V20.5H18V21H6ZM18 18.5H6V6.0625H18V18.5ZM21 6H20V5.0625C20 4.5105 19.552 4.0625 19 4.0625H5C4.448 4.0625 4 4.5105 4 5.0625V6H3V3H21V6ZM8.293 12.2695C7.9025 11.879 7.9025 11.246 8.293 10.8555L11.2925 7.856C11.339 7.809 11.3905 7.7675 11.446 7.7305C11.4695 7.7145 11.4955 7.704 11.52 7.69C11.5525 7.672 11.5835 7.6525 11.618 7.6385C11.6505 7.625 11.6845 7.6175 11.718 7.6075C11.747 7.599 11.7745 7.588 11.8045 7.582C11.934 7.556 12.067 7.556 12.196 7.582C12.226 7.588 12.2535 7.599 12.2825 7.6075C12.316 7.6175 12.35 7.625 12.3825 7.6385C12.417 7.6525 12.448 7.672 12.4805 7.69C12.5055 7.7035 12.531 7.7145 12.5545 7.7305C12.6095 7.7675 12.661 7.809 12.708 7.856L15.7075 10.8555C16.098 11.246 16.098 11.879 15.7075 12.2695C15.512 12.465 15.2565 12.5625 15.0005 12.5625C14.7445 12.5625 14.489 12.465 14.2935 12.2695L13 10.9765V15.5C13 16.052 12.552 16.5 12 16.5C11.448 16.5 11 16.052 11 15.5V10.9765L9.707 12.2695C9.3165 12.66 8.6835 12.66 8.293 12.2695Z" fill="#222222"/>
3
+ </svg>
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": "7.27.0",
4
+ "version": "7.29.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -6,6 +6,8 @@ import { screen } from '../../../theme/shared/size';
6
6
  import Text from '../../Atoms/Text/Text';
7
7
  import Picture from '../../Atoms/Picture/Picture';
8
8
  import Form from './Form/Form';
9
+ import { handleTitles, handleCopy } from './_utils';
10
+
9
11
  import {
10
12
  BgImage,
11
13
  Container,
@@ -43,12 +45,18 @@ const Donate = ({
43
45
  otherAmountValue,
44
46
  additionalSingleCopy,
45
47
  additionalMonthlyCopy,
46
- defaultGivingType
48
+ defaultGivingType,
49
+ monthlyTitle,
50
+ monthlySubtitle,
51
+ // Just to keep the function call character length under control
52
+ monthlyChooseAmountText: monthlyChoose,
53
+ monthlyOtherAmountText: monthlyOther
47
54
  }) => {
48
55
  let isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
49
56
 
50
57
  // To let us store any updated override, and force a re-render
51
58
  const [overrideValue, setOverrideValue] = useState(null);
59
+ const [givingType, setGivingType] = useState();
52
60
 
53
61
  // Store the updated override value
54
62
  useEffect(() => {
@@ -58,6 +66,18 @@ const Donate = ({
58
66
  // If a boolean value has been passed, let it replace our 'internal' value
59
67
  isDesktop = overrideValue !== null ? overrideValue : isDesktop;
60
68
 
69
+ // Handy helper functions to process copy, based on givingType
70
+ const {
71
+ showCopy,
72
+ thisTitle,
73
+ thisSubtitle
74
+ } = handleTitles(givingType, title, subtitle, monthlyTitle, monthlySubtitle);
75
+
76
+ const {
77
+ thisOtherAmountText,
78
+ thisChooseAmountText
79
+ } = handleCopy(givingType, otherAmountText, chooseAmountText, monthlyOther, monthlyChoose);
80
+
61
81
  return (
62
82
  <Container
63
83
  mobileBackgroundColor={mobileBackgroundColor}
@@ -95,9 +115,8 @@ const Donate = ({
95
115
  <Wrapper formAlignRight={formAlignRight} aria-live="polite">
96
116
  <Header formAlignRight={formAlignRight}>
97
117
  <HeaderInner>
98
- {Boolean(subtitle) && (
118
+ {showCopy && (
99
119
  <>
100
- {Boolean(title) && (
101
120
  <Text
102
121
  tag="h2"
103
122
  color={textColor}
@@ -106,12 +125,10 @@ const Donate = ({
106
125
  weight="normal"
107
126
  uppercase
108
127
  >
109
- {title}
128
+ {thisTitle}
110
129
  </Text>
111
- )}
112
-
113
130
  <Text tag="p" color={textColor} size="m">
114
- {subtitle}
131
+ {thisSubtitle}
115
132
  </Text>
116
133
  </>
117
134
  )}
@@ -120,19 +137,21 @@ const Donate = ({
120
137
 
121
138
  <Form
122
139
  data={data}
123
- otherAmountText={otherAmountText}
140
+ otherAmountText={thisOtherAmountText}
124
141
  cartID={cartID}
125
142
  clientID={clientID}
126
143
  mbshipID={mbshipID}
127
144
  donateLink={donateLink}
128
145
  noMoneyBuys={noMoneyBuys}
129
146
  PopUpText={PopUpText}
130
- chooseAmountText={chooseAmountText}
147
+ chooseAmountText={thisChooseAmountText}
131
148
  submitButtonColor={submitButtonColor}
132
149
  otherAmountValue={otherAmountValue}
133
150
  additionalSingleCopy={additionalSingleCopy}
134
151
  additionalMonthlyCopy={additionalMonthlyCopy}
135
152
  defaultGivingType={defaultGivingType}
153
+ givingType={givingType}
154
+ changeGivingType={setGivingType}
136
155
  />
137
156
  </Wrapper>
138
157
  </Container>
@@ -168,7 +187,11 @@ Donate.propTypes = {
168
187
  otherAmountValue: PropTypes.number,
169
188
  additionalSingleCopy: PropTypes.string,
170
189
  additionalMonthlyCopy: PropTypes.string,
171
- defaultGivingType: PropTypes.string
190
+ defaultGivingType: PropTypes.string,
191
+ monthlyTitle: PropTypes.string,
192
+ monthlySubtitle: PropTypes.string,
193
+ monthlyChooseAmountText: PropTypes.string,
194
+ monthlyOtherAmountText: PropTypes.string
172
195
  };
173
196
 
174
197
  Donate.defaultProps = {
@@ -198,7 +221,11 @@ Donate.defaultProps = {
198
221
  title: null,
199
222
  additionalSingleCopy: null,
200
223
  additionalMonthlyCopy: null,
201
- defaultGivingType: null
224
+ defaultGivingType: null,
225
+ monthlyTitle: null,
226
+ monthlySubtitle: null,
227
+ monthlyChooseAmountText: null,
228
+ monthlyOtherAmountText: null
202
229
  };
203
230
 
204
231
  export default Donate;
@@ -513,7 +513,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
513
513
  mobileImageLow={mobilePictures.imageLow}
514
514
  mobileImages={mobilePictures.images}
515
515
  data={data}
516
- mbshipID="mship-15"
516
+ mbshipID="mship-16"
517
517
  donateLink="https://donation.comicrelief.com/"
518
518
  clientID="donate"
519
519
  cartID="default-comicrelief"
@@ -521,4 +521,99 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
521
521
  subtitle="Please help us fund life-changing projects in the UK and around the world."
522
522
  noMoneyBuys
523
523
  />;
524
+ ```
525
+
526
+ ## Monthly 'Choose Amount' and 'Other Amount' copy overrides
527
+
528
+ ```js
529
+ import data from './dev-data/data';
530
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
531
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
532
+
533
+ <Donate
534
+ alt="Background image"
535
+ mobileBackgroundColor="deep_violet_dark"
536
+ desktopOverlayColor="red"
537
+ submitButtonColor="blue_dark"
538
+ formAlignRight={true}
539
+ imageLow={desktopPictures.imageLow}
540
+ images={desktopPictures.images}
541
+ mobileImageLow={mobilePictures.imageLow}
542
+ mobileImages={mobilePictures.images}
543
+ data={data}
544
+ mbshipID="mship-17"
545
+ donateLink="https://donation.comicrelief.com/"
546
+ clientID="donate"
547
+ cartID="default-comicrelief"
548
+ title="Standard title here"
549
+ subtitle="Standard subtitle here"
550
+ otherAmountText="Here's an otherAmountText override"
551
+ chooseAmountText="Here's an chooseAmountText override"
552
+ monthlyChooseAmountText="monthlyChooseAmountText here"
553
+ monthlyOtherAmountText="monthlyOtherAmountText here"
554
+ />;
555
+ ```
556
+
557
+ ## Monthly Title and Subtitle overrides
558
+
559
+ ```js
560
+ import data from './dev-data/data';
561
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
562
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
563
+
564
+ <Donate
565
+ alt="Background image"
566
+ mobileBackgroundColor="deep_violet_dark"
567
+ desktopOverlayColor="red"
568
+ submitButtonColor="blue_dark"
569
+ formAlignRight={true}
570
+ imageLow={desktopPictures.imageLow}
571
+ images={desktopPictures.images}
572
+ mobileImageLow={mobilePictures.imageLow}
573
+ mobileImages={mobilePictures.images}
574
+ data={data}
575
+ mbshipID="mship-18"
576
+ donateLink="https://donation.comicrelief.com/"
577
+ clientID="donate"
578
+ cartID="default-comicrelief"
579
+ title="Standard title here"
580
+ subtitle="Standard subtitle here"
581
+ otherAmountText="Here's an otherAmountText override"
582
+ chooseAmountText="Here's an chooseAmountText override"
583
+ monthlyTitle="Monthly Title here"
584
+ monthlySubtitle="Monthly Subtitle here"
585
+ />;
586
+ ```
587
+
588
+ ## All monthly overrides
589
+
590
+ ```js
591
+ import data from './dev-data/data';
592
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
593
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
594
+
595
+ <Donate
596
+ alt="Background image"
597
+ mobileBackgroundColor="deep_violet_dark"
598
+ desktopOverlayColor="red"
599
+ submitButtonColor="blue_dark"
600
+ formAlignRight={true}
601
+ imageLow={desktopPictures.imageLow}
602
+ images={desktopPictures.images}
603
+ mobileImageLow={mobilePictures.imageLow}
604
+ mobileImages={mobilePictures.images}
605
+ data={data}
606
+ mbshipID="mship-19"
607
+ donateLink="https://donation.comicrelief.com/"
608
+ clientID="donate"
609
+ cartID="default-comicrelief"
610
+ title="Standard title here"
611
+ subtitle="Standard subtitle here"
612
+ otherAmountText="Here's an otherAmountText override"
613
+ chooseAmountText="Here's an chooseAmountText override"
614
+ monthlyTitle="Monthly Title here"
615
+ monthlySubtitle="Monthly Subtitle here"
616
+ monthlyChooseAmountText="monthlyChooseAmountText here"
617
+ monthlyOtherAmountText="monthlyOtherAmountText here"
618
+ />;
524
619
  ```
@@ -41,9 +41,13 @@ const Signup = ({
41
41
  additionalSingleCopy,
42
42
  additionalMonthlyCopy,
43
43
  defaultGivingType,
44
+ monthlyChooseAmountCopy,
45
+ monthlyOtherAmountCopy,
46
+ changeGivingType,
47
+ givingType,
44
48
  ...rest
45
49
  }) => {
46
- const [givingType, setGivingType] = useState();
50
+ // const [givingType, setGivingType] = useState();
47
51
  const [errorMsg, setErrorMsg] = useState(false);
48
52
  const [amountDonate, setAmountDonate] = useState(10);
49
53
  const [moneyBuyCopy, setMoneyBuyCopy] = useState(true);
@@ -68,7 +72,9 @@ const Signup = ({
68
72
 
69
73
  setAmountDonate(thisAmount);
70
74
  }
71
- }, [givingType, singleGiving, regularGiving, otherAmountValue]);
75
+ // Pass givingType up to parent for copy-switching logic:
76
+ changeGivingType(givingType);
77
+ }, [givingType, singleGiving, regularGiving, otherAmountValue, changeGivingType]);
72
78
 
73
79
  useEffect(() => {
74
80
  if (givingType) {
@@ -115,13 +121,16 @@ const Signup = ({
115
121
 
116
122
  // On load, determine what should actually be the default giving type
117
123
  useEffect(() => {
124
+ let newGivingType;
118
125
  // Use any explicit setting
119
126
  if (defaultGivingType) {
120
- setGivingType(defaultGivingType);
127
+ newGivingType = defaultGivingType;
121
128
  } else {
122
129
  // Else, use whatever's available
123
- setGivingType(singleGiving !== null ? 'single' : 'monthly');
130
+ newGivingType = singleGiving !== null ? 'single' : 'monthly';
124
131
  }
132
+
133
+ changeGivingType(newGivingType);
125
134
  // eslint-disable-next-line react-hooks/exhaustive-deps
126
135
  }, []);
127
136
 
@@ -217,7 +226,7 @@ const Signup = ({
217
226
  {showGivingSelector && (
218
227
  <GivingSelector
219
228
  givingType={givingType}
220
- changeGivingType={data => setGivingType(data)}
229
+ changeGivingType={data => changeGivingType(data)}
221
230
  setPopOpen={setPopOpen}
222
231
  mbshipID={mbshipID}
223
232
  />
@@ -333,7 +342,11 @@ Signup.propTypes = {
333
342
  otherAmountValue: PropTypes.number,
334
343
  additionalSingleCopy: PropTypes.string,
335
344
  additionalMonthlyCopy: PropTypes.string,
336
- defaultGivingType: PropTypes.string
345
+ defaultGivingType: PropTypes.string,
346
+ monthlyChooseAmountCopy: PropTypes.string.isRequired,
347
+ monthlyOtherAmountCopy: PropTypes.string.isRequired,
348
+ changeGivingType: PropTypes.func.isRequired,
349
+ givingType: PropTypes.string.isRequired
337
350
  };
338
351
 
339
352
  Signup.defaultProps = {
@@ -432,6 +432,10 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
432
432
  }
433
433
  }
434
434
 
435
+ @media (min-width:1024px) {
436
+
437
+ }
438
+
435
439
  @media (min-width:740px) {
436
440
  .c1 {
437
441
  padding: 4rem 1rem;
@@ -1718,6 +1722,14 @@ exports[`Single donation renders correctly 1`] = `
1718
1722
  }
1719
1723
  }
1720
1724
 
1725
+ @media (min-width:740px) {
1726
+
1727
+ }
1728
+
1729
+ @media (min-width:1024px) {
1730
+
1731
+ }
1732
+
1721
1733
  @media (min-width:1024px) {
1722
1734
  .c2 {
1723
1735
  width: 50%;
@@ -0,0 +1,28 @@
1
+ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
2
+ let thisTitle; let thisSubtitle;
3
+ const showMonthlyCopy = givingType === 'monthly' && Boolean(monthlySubtitle) && Boolean(monthlyTitle);
4
+ // Overall flag as to whether we render copy *at all*
5
+ const showCopy = showMonthlyCopy || (Boolean(subtitle) && Boolean(title));
6
+
7
+ // Apply the override if we've got monthly content AND giving type:
8
+ if (showMonthlyCopy) {
9
+ thisTitle = monthlyTitle;
10
+ thisSubtitle = monthlyTitle;
11
+ } else if (showCopy) {
12
+ // Else, fall back to the default, after checking it's appropriate
13
+ thisTitle = title;
14
+ thisSubtitle = subtitle;
15
+ }
16
+
17
+ return { showCopy, thisTitle, thisSubtitle };
18
+ };
19
+
20
+ const handleCopy = (gType, otherAmount, chooseAmount, monthlyOtherAmount, monthlyChooseAmount) => {
21
+ // Only use any monthly overrides for the appropriate givingType
22
+ const thisOtherAmountText = (gType === 'monthly' && Boolean(monthlyOtherAmount) ? monthlyOtherAmount : otherAmount);
23
+ const thisChooseAmountText = (gType === 'monthly' && Boolean(monthlyChooseAmount) ? monthlyChooseAmount : chooseAmount);
24
+
25
+ return { thisOtherAmountText, thisChooseAmountText };
26
+ };
27
+
28
+ export { handleTitles, handleCopy };
@@ -116,6 +116,8 @@ import data from './data/data';
116
116
  import Link from '../../Atoms/Link/Link';
117
117
  import searchIcon from './assets/icon--search--2023.svg';
118
118
  import shopIcon from './assets/icon--shop--2023.svg';
119
+ import payinIcon from './assets/PayIn.svg';
120
+
119
121
  import Icon from '../../Atoms/SocialIcons/Icon/Icon';
120
122
  import RichText from '../../Atoms/RichText/RichText';
121
123
 
@@ -170,6 +172,17 @@ const [success, setSuccess] = React.useState(false);
170
172
  tabIndex="0"
171
173
  />
172
174
  </div>
175
+ <div>
176
+ <Icon
177
+ icon={payinIcon}
178
+ title="Payin"
179
+ target="_blank"
180
+ role="button"
181
+ href="https://donation.comicrelief.com/?cartId=rnd23-fundraisingpayin"
182
+ brand="comicrelief"
183
+ tabIndex="0"
184
+ />
185
+ </div>
173
186
  </>
174
187
  }
175
188
  />;
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M22 1H2C1.448 1 1 1.448 1 2V7C1 7.552 1.448 8 2 8H4V19V19.5V22C4 22.552 4.448 23 5 23H19C19.552 23 20 22.552 20 22V19.5V19V8H22C22.552 8 23 7.552 23 7V2C23 1.448 22.552 1 22 1ZM6 21V20.5H18V21H6ZM18 18.5H6V6.0625H18V18.5ZM21 6H20V5.0625C20 4.5105 19.552 4.0625 19 4.0625H5C4.448 4.0625 4 4.5105 4 5.0625V6H3V3H21V6ZM8.293 12.2695C7.9025 11.879 7.9025 11.246 8.293 10.8555L11.2925 7.856C11.339 7.809 11.3905 7.7675 11.446 7.7305C11.4695 7.7145 11.4955 7.704 11.52 7.69C11.5525 7.672 11.5835 7.6525 11.618 7.6385C11.6505 7.625 11.6845 7.6175 11.718 7.6075C11.747 7.599 11.7745 7.588 11.8045 7.582C11.934 7.556 12.067 7.556 12.196 7.582C12.226 7.588 12.2535 7.599 12.2825 7.6075C12.316 7.6175 12.35 7.625 12.3825 7.6385C12.417 7.6525 12.448 7.672 12.4805 7.69C12.5055 7.7035 12.531 7.7145 12.5545 7.7305C12.6095 7.7675 12.661 7.809 12.708 7.856L15.7075 10.8555C16.098 11.246 16.098 11.879 15.7075 12.2695C15.512 12.465 15.2565 12.5625 15.0005 12.5625C14.7445 12.5625 14.489 12.465 14.2935 12.2695L13 10.9765V15.5C13 16.052 12.552 16.5 12 16.5C11.448 16.5 11 16.052 11 15.5V10.9765L9.707 12.2695C9.3165 12.66 8.6835 12.66 8.293 12.2695Z" fill="#222222"/>
3
+ </svg>