@comicrelief/component-library 7.29.0 → 7.31.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.
package/README.md CHANGED
@@ -40,13 +40,13 @@ $ yarn styleguide
40
40
 
41
41
  To test:
42
42
  ```
43
- $ yarn test
43
+ $ yarn test:unit
44
44
  ```
45
45
  _Test will run through all Jest tests and watch for any changes on snapshots._
46
46
 
47
47
  To update snapshots with desired changes brought in through your work:
48
48
  ```
49
- $ yarn test -u
49
+ $ yarn test:unit-update
50
50
  ```
51
51
 
52
52
  To publish
@@ -71,7 +71,8 @@ const Donate = _ref => {
71
71
  const {
72
72
  showCopy,
73
73
  thisTitle,
74
- thisSubtitle
74
+ thisSubtitle,
75
+ noTitlesAtAll
75
76
  } = (0, _utils.handleTitles)(givingType, title, subtitle, monthlyTitle, monthlySubtitle);
76
77
  const {
77
78
  thisOtherAmountText,
@@ -103,10 +104,12 @@ const Donate = _ref => {
103
104
  isBackgroundImage: true
104
105
  }) : null, /*#__PURE__*/_react.default.createElement(_Donate.Wrapper, {
105
106
  formAlignRight: formAlignRight,
106
- "aria-live": "polite"
107
- }, /*#__PURE__*/_react.default.createElement(_Donate.Header, {
108
- formAlignRight: formAlignRight
109
- }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, showCopy && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
107
+ "aria-live": "polite",
108
+ noTitlesAtAll: noTitlesAtAll
109
+ }, !noTitlesAtAll && /*#__PURE__*/_react.default.createElement(_Donate.TitleWrapperOuter, {
110
+ formAlignRight: formAlignRight,
111
+ "data-test": "this-one-here"
112
+ }, /*#__PURE__*/_react.default.createElement(_Donate.TitleWrapperInner, null, showCopy && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
110
113
  tag: "h2",
111
114
  color: textColor,
112
115
  size: "big",
@@ -163,9 +166,9 @@ Donate.defaultProps = {
163
166
  additionalSingleCopy: null,
164
167
  additionalMonthlyCopy: null,
165
168
  defaultGivingType: null,
166
- monthlyTitle: null,
167
- monthlySubtitle: null,
168
- monthlyChooseAmountText: null,
169
- monthlyOtherAmountText: null
169
+ monthlyTitle: '',
170
+ monthlySubtitle: '',
171
+ monthlyChooseAmountText: '',
172
+ monthlyOtherAmountText: ''
170
173
  };
171
174
  var _default = exports.default = Donate;
@@ -131,7 +131,7 @@ setTimeout(()=>{
131
131
  mobileImageLow={mobilePictures.imageLow}
132
132
  mobileImages={mobilePictures.images}
133
133
  data={data}
134
- mbshipID="mship-4"
134
+ mbshipID="mship-5"
135
135
  donateLink="https://donation.comicrelief.com/"
136
136
  clientID="donate"
137
137
  cartID="default-comicrelief"
@@ -139,6 +139,8 @@ setTimeout(()=>{
139
139
  noMoneyBuys
140
140
  subtitle="Please help us fund life-changing projects in the UK and around the world."
141
141
  otherAmountValue={amountDonate}
142
+ otherAmountText="Here's an otherAmountText override"
143
+
142
144
  />;
143
145
  ```
144
146
 
@@ -166,7 +168,7 @@ setTimeout(()=>{
166
168
  mobileImageLow={mobilePictures.imageLow}
167
169
  mobileImages={mobilePictures.images}
168
170
  data={data}
169
- mbshipID="mship-1"
171
+ mbshipID="mship-6"
170
172
  donateLink="https://donation.comicrelief.com/"
171
173
  clientID="donate"
172
174
  cartID="default-comicrelief"
@@ -191,7 +193,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
191
193
  mobileImageLow={mobilePictures.imageLow}
192
194
  mobileImages={mobilePictures.images}
193
195
  data={data}
194
- mbshipID="mship-2"
196
+ mbshipID="mship-7"
195
197
  donateLink="https://donation.comicrelief.com/"
196
198
  clientID="donate"
197
199
  cartID="default-comicrelief"
@@ -202,7 +204,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
202
204
  ```
203
205
 
204
206
 
205
- ## Form align right - no subtitle
207
+ ## Form align right, but no copy, so ACTUALLY centre-aligns
206
208
 
207
209
  ```js
208
210
  import data from './dev-data/data';
@@ -220,12 +222,16 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
220
222
  mobileImageLow={mobilePictures.imageLow}
221
223
  mobileImages={mobilePictures.images}
222
224
  data={data}
223
- mbshipID="mship-5"
225
+ mbshipID="mship-8"
224
226
  donateLink="https://donation.comicrelief.com/"
225
227
  clientID="donate"
226
228
  cartID="default-comicrelief"
227
- title="Donate Now"
229
+ // Directly omiting values for these to centre-align
230
+ title=""
228
231
  subtitle=""
232
+ chooseAmountText=""
233
+ monthlyTitle=""
234
+ monthlySubtitle=""
229
235
  />;
230
236
  ```
231
237
 
@@ -245,7 +251,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
245
251
  mobileImageLow={mobilePictures.imageLow}
246
252
  mobileImages={mobilePictures.images}
247
253
  data={data}
248
- mbshipID="mship-6"
254
+ mbshipID="mship-9"
249
255
  donateLink="https://donation.comicrelief.com/"
250
256
  clientID="donate"
251
257
  cartID="default-comicrelief"
@@ -270,7 +276,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
270
276
  mobileImageLow={mobilePictures.imageLow}
271
277
  mobileImages={mobilePictures.images}
272
278
  data={data}
273
- mbshipID="mship-7"
279
+ mbshipID="mship-10"
274
280
  donateLink="https://donation.comicrelief.com/"
275
281
  clientID="donate"
276
282
  cartID="default-comicrelief"
@@ -295,7 +301,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
295
301
  mobileImageLow={mobilePictures.imageLow}
296
302
  mobileImages={mobilePictures.images}
297
303
  data={data}
298
- mbshipID="mship-8"
304
+ mbshipID="mship-11"
299
305
  donateLink="https://donation.comicrelief.com/"
300
306
  clientID="donate"
301
307
  cartID="default-comicrelief"
@@ -316,7 +322,7 @@ import data from './dev-data/data-single';
316
322
  mobileBackgroundColor="blue_dark"
317
323
  formAlignRight={false}
318
324
  data={data}
319
- mbshipID="mship-9"
325
+ mbshipID="mship-12"
320
326
  donateLink="https://donation.comicrelief.com/"
321
327
  clientID="donate"
322
328
  cartID="default-comicrelief"
@@ -345,7 +351,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
345
351
  mobileImageLow={mobilePictures.imageLow}
346
352
  mobileImages={mobilePictures.images}
347
353
  data={data}
348
- mbshipID="mship-10"
354
+ mbshipID="mship-13"
349
355
  donateLink="https://donation.comicrelief.com/"
350
356
  clientID="donate"
351
357
  cartID="default-comicrelief"
@@ -373,7 +379,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
373
379
  mobileImageLow={mobilePictures.imageLow}
374
380
  mobileImages={mobilePictures.images}
375
381
  data={data}
376
- mbshipID="mship-11"
382
+ mbshipID="mship-14"
377
383
  donateLink="https://donation.comicrelief.com/"
378
384
  clientID="donate"
379
385
  cartID="default-comicrelief"
@@ -402,7 +408,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
402
408
  mobileImageLow={mobilePictures.imageLow}
403
409
  mobileImages={mobilePictures.images}
404
410
  data={data}
405
- mbshipID="mship-12"
411
+ mbshipID="mship-15"
406
412
  donateLink="https://donation.comicrelief.com/"
407
413
  clientID="donate"
408
414
  cartID="default-comicrelief"
@@ -430,7 +436,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
430
436
  mobileImageLow={mobilePictures.imageLow}
431
437
  mobileImages={mobilePictures.images}
432
438
  data={data}
433
- mbshipID="mship-13"
439
+ mbshipID="mship-16"
434
440
  donateLink="https://donation.comicrelief.com/"
435
441
  clientID="donate"
436
442
  cartID="default-comicrelief"
@@ -458,7 +464,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
458
464
  mobileImageLow={mobilePictures.imageLow}
459
465
  mobileImages={mobilePictures.images}
460
466
  data={data}
461
- mbshipID="mship-14"
467
+ mbshipID="mship-17"
462
468
  donateLink="https://donation.comicrelief.com/"
463
469
  clientID="donate"
464
470
  cartID="default-comicrelief"
@@ -486,7 +492,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
486
492
  mobileImageLow={mobilePictures.imageLow}
487
493
  mobileImages={mobilePictures.images}
488
494
  data={data}
489
- mbshipID="mship-15"
495
+ mbshipID="mship-18"
490
496
  donateLink="https://donation.comicrelief.com/"
491
497
  clientID="donate"
492
498
  cartID="default-comicrelief"
@@ -513,7 +519,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
513
519
  mobileImageLow={mobilePictures.imageLow}
514
520
  mobileImages={mobilePictures.images}
515
521
  data={data}
516
- mbshipID="mship-16"
522
+ mbshipID="mship-19"
517
523
  donateLink="https://donation.comicrelief.com/"
518
524
  clientID="donate"
519
525
  cartID="default-comicrelief"
@@ -541,7 +547,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
541
547
  mobileImageLow={mobilePictures.imageLow}
542
548
  mobileImages={mobilePictures.images}
543
549
  data={data}
544
- mbshipID="mship-17"
550
+ mbshipID="mship-20"
545
551
  donateLink="https://donation.comicrelief.com/"
546
552
  clientID="donate"
547
553
  cartID="default-comicrelief"
@@ -572,7 +578,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
572
578
  mobileImageLow={mobilePictures.imageLow}
573
579
  mobileImages={mobilePictures.images}
574
580
  data={data}
575
- mbshipID="mship-18"
581
+ mbshipID="mship-21"
576
582
  donateLink="https://donation.comicrelief.com/"
577
583
  clientID="donate"
578
584
  cartID="default-comicrelief"
@@ -603,7 +609,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
603
609
  mobileImageLow={mobilePictures.imageLow}
604
610
  mobileImages={mobilePictures.images}
605
611
  data={data}
606
- mbshipID="mship-19"
612
+ mbshipID="mship-22"
607
613
  donateLink="https://donation.comicrelief.com/"
608
614
  clientID="donate"
609
615
  cartID="default-comicrelief"
@@ -616,4 +622,4 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
616
622
  monthlyChooseAmountText="monthlyChooseAmountText here"
617
623
  monthlyOtherAmountText="monthlyOtherAmountText here"
618
624
  />;
619
- ```
625
+ ```
@@ -1,19 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
- exports.Wrapper = exports.PopUp = exports.OuterFieldset = exports.MoneyBuys = exports.Legend = exports.Label = exports.HeaderInner = exports.Header = exports.FormWrapper = exports.FormFieldset = exports.Form = exports.Error = exports.Copy = exports.Container = exports.Button = exports.BgImage = exports.AmountField = void 0;
8
- var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ exports.Wrapper = exports.TitleWrapperOuter = exports.TitleWrapperInner = exports.PopUp = exports.OuterFieldset = exports.MoneyBuys = exports.Legend = exports.Label = exports.FormWrapper = exports.FormFieldset = exports.Form = exports.Error = exports.Copy = exports.Container = exports.Button = exports.BgImage = exports.AmountField = void 0;
9
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
10
  var _Input = _interopRequireDefault(require("../../Atoms/Input/Input"));
10
11
  var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
11
12
  var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
12
13
  var _size = require("../../../theme/shared/size");
13
14
  var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
14
15
  var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
15
- // import styled, { css } from 'styled-components';
16
-
17
16
  const Container = exports.Container = _styledComponents.default.div.withConfig({
18
17
  displayName: "Donatestyle__Container",
19
18
  componentId: "sc-8rjm3t-0"
@@ -46,55 +45,60 @@ const BgImage = exports.BgImage = (0, _styledComponents.default)(_Picture.defaul
46
45
  const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
47
46
  displayName: "Donatestyle__Wrapper",
48
47
  componentId: "sc-8rjm3t-3"
49
- })(["position:relative;text-align:center;padding:", " ", ";flex-direction:row;align-items:center;display:block;width:100%;flex-direction:", ";", "{padding:", " ", ";}", "{display:flex;padding:", " 0;}"], (0, _spacing.default)('l'), (0, _spacing.default)('md'), _ref4 => {
48
+ })(["position:relative;text-align:center;padding:", " ", ";flex-direction:row;align-items:center;display:block;width:100%;flex-direction:", ";", ";", "{padding:", " ", ";}", "{display:flex;padding:", " 0;}"], (0, _spacing.default)('l'), (0, _spacing.default)('md'), _ref4 => {
50
49
  let {
51
50
  formAlignRight
52
51
  } = _ref4;
53
52
  return formAlignRight === true ? 'row-reverse' : 'row';
53
+ }, _ref5 => {
54
+ let {
55
+ noTitlesAtAll
56
+ } = _ref5;
57
+ return noTitlesAtAll === true && (0, _styledComponents.css)(["justify-content:center;"]);
54
58
  }, (0, _size.media)('small'), (0, _spacing.default)('xl'), (0, _spacing.default)('md'), (0, _size.media)('medium'), (0, _spacing.default)('xl'));
55
- const Header = exports.Header = _styledComponents.default.div.withConfig({
56
- displayName: "Donatestyle__Header",
59
+ const TitleWrapperOuter = exports.TitleWrapperOuter = _styledComponents.default.div.withConfig({
60
+ displayName: "Donatestyle__TitleWrapperOuter",
57
61
  componentId: "sc-8rjm3t-4"
58
- })(["width:100%;display:flex;font-family:", ";", "{width:50%;padding:", ";align-items:center;}"], _ref5 => {
62
+ })(["width:100%;display:flex;font-family:", ";", "{width:50%;padding:", ";align-items:center;}"], _ref6 => {
59
63
  let {
60
64
  theme
61
- } = _ref5;
65
+ } = _ref6;
62
66
  return theme.fontFamilies(theme.font.regular);
63
67
  }, (0, _size.media)('medium'), (0, _spacing.default)('xl'));
64
- const HeaderInner = exports.HeaderInner = _styledComponents.default.div.withConfig({
65
- displayName: "Donatestyle__HeaderInner",
68
+ const TitleWrapperInner = exports.TitleWrapperInner = _styledComponents.default.div.withConfig({
69
+ displayName: "Donatestyle__TitleWrapperInner",
66
70
  componentId: "sc-8rjm3t-5"
67
71
  })(["position:relative;text-align:left;"]);
68
72
  const FormWrapper = exports.FormWrapper = _styledComponents.default.div.withConfig({
69
73
  displayName: "Donatestyle__FormWrapper",
70
74
  componentId: "sc-8rjm3t-6"
71
- })(["position:relative;font-family:", ";", "{width:50%;}"], _ref6 => {
75
+ })(["position:relative;font-family:", ";", "{width:50%;}"], _ref7 => {
72
76
  let {
73
77
  theme
74
- } = _ref6;
78
+ } = _ref7;
75
79
  return theme.fontFamilies(theme.font.regular);
76
80
  }, (0, _size.media)('medium'));
77
81
  const Error = exports.Error = (0, _styledComponents.default)(_Text.default).withConfig({
78
82
  displayName: "Donatestyle__Error",
79
83
  componentId: "sc-8rjm3t-7"
80
- })(["color:", ";font-size:", ";font-weight:500;margin-top:", ";"], _ref7 => {
84
+ })(["color:", ";font-size:", ";font-weight:500;margin-top:", ";"], _ref8 => {
81
85
  let {
82
86
  theme
83
- } = _ref7;
87
+ } = _ref8;
84
88
  return theme.color('red');
85
- }, _ref8 => {
89
+ }, _ref9 => {
86
90
  let {
87
91
  theme
88
- } = _ref8;
92
+ } = _ref9;
89
93
  return theme.fontSize('s');
90
94
  }, (0, _spacing.default)('l'));
91
95
  const Form = exports.Form = _styledComponents.default.form.withConfig({
92
96
  displayName: "Donatestyle__Form",
93
97
  componentId: "sc-8rjm3t-8"
94
- })(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);border-radius:10px;margin-top:", ";h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}", "{width:450px;margin-right:auto;margin-left:auto;}"], _ref9 => {
98
+ })(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);border-radius:10px;margin-top:", ";h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}", "{width:450px;margin-right:auto;margin-left:auto;}"], _ref10 => {
95
99
  let {
96
100
  theme
97
- } = _ref9;
101
+ } = _ref10;
98
102
  return theme.color('white');
99
103
  }, (0, _spacing.default)('md'), (0, _spacing.default)('md'), (0, _spacing.default)('l'), (0, _size.media)('small'));
100
104
  const OuterFieldset = exports.OuterFieldset = _styledComponents.default.fieldset.withConfig({
@@ -120,20 +124,20 @@ const Label = exports.Label = (0, _styledComponents.default)(_Text.default).with
120
124
  const AmountField = exports.AmountField = (0, _styledComponents.default)(_Input.default).withConfig({
121
125
  displayName: "Donatestyle__AmountField",
122
126
  componentId: "sc-8rjm3t-14"
123
- })(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", "{flex-basis:60%;}span{position:absolute;font-size:20px;top:50%;transform:translateY(-50%);left:0px;font-weight:500;padding:0px 15px;", ";}input{height:48px;border:2px solid ", ";background:", ";border-radius:10px;padding:", " ", " ", " ", ";&:focus{outline:none;border:2px solid ", ";}}"], (0, _size.media)('small'), (0, _zIndex.default)('high'), _ref10 => {
127
+ })(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", "{flex-basis:60%;}span{position:absolute;font-size:20px;top:50%;transform:translateY(-50%);left:0px;font-weight:500;padding:0px 15px;", ";}input{height:48px;border:2px solid ", ";background:", ";border-radius:10px;padding:", " ", " ", " ", ";&:focus{outline:none;border:2px solid ", ";}}"], (0, _size.media)('small'), (0, _zIndex.default)('high'), _ref11 => {
124
128
  let {
125
129
  theme
126
- } = _ref10;
130
+ } = _ref11;
127
131
  return theme.color('grey');
128
- }, _ref11 => {
132
+ }, _ref12 => {
129
133
  let {
130
134
  theme
131
- } = _ref11;
135
+ } = _ref12;
132
136
  return theme.color('grey_light');
133
- }, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'), _ref12 => {
137
+ }, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'), _ref13 => {
134
138
  let {
135
139
  theme
136
- } = _ref12;
140
+ } = _ref13;
137
141
  return theme.color('grey');
138
142
  });
139
143
  const Copy = exports.Copy = (0, _styledComponents.default)(_Text.default).withConfig({
@@ -143,25 +147,25 @@ const Copy = exports.Copy = (0, _styledComponents.default)(_Text.default).withCo
143
147
  const Button = exports.Button = _styledComponents.default.button.withConfig({
144
148
  displayName: "Donatestyle__Button",
145
149
  componentId: "sc-8rjm3t-16"
146
- })(["width:100%;margin:", " 0 ", ";color:", ";font-size:", ";font-weight:bold;cursor:pointer;min-height:48px;background:", ";text-decoration:none;border-radius:2rem;border:none;box-shadow:0px 0px 16px rgba(0,0,0,0.15);appearance:none;:active,:focus,:hover{outline:none;background-color:", ";}", "{padding:", " ", ";}"], (0, _spacing.default)('l'), (0, _spacing.default)('l'), _ref13 => {
150
+ })(["width:100%;margin:", " 0 ", ";color:", ";font-size:", ";font-weight:bold;cursor:pointer;min-height:48px;background:", ";text-decoration:none;border-radius:2rem;border:none;box-shadow:0px 0px 16px rgba(0,0,0,0.15);appearance:none;:active,:focus,:hover{outline:none;background-color:", ";}", "{padding:", " ", ";}"], (0, _spacing.default)('l'), (0, _spacing.default)('l'), _ref14 => {
147
151
  let {
148
152
  theme
149
- } = _ref13;
153
+ } = _ref14;
150
154
  return theme.color('white');
151
- }, _ref14 => {
155
+ }, _ref15 => {
152
156
  let {
153
157
  theme
154
- } = _ref14;
158
+ } = _ref15;
155
159
  return theme.fontSize('s');
156
- }, _ref15 => {
160
+ }, _ref16 => {
157
161
  let {
158
162
  theme,
159
163
  color
160
- } = _ref15;
164
+ } = _ref16;
161
165
  return theme.color(color);
162
- }, _ref16 => {
166
+ }, _ref17 => {
163
167
  let {
164
168
  theme
165
- } = _ref16;
169
+ } = _ref17;
166
170
  return theme.color('coral_dark');
167
171
  }, (0, _size.media)('small'), (0, _spacing.default)('md'), (0, _spacing.default)('l'));
@@ -65,10 +65,11 @@ const Signup = _ref => {
65
65
  (0, _react.useEffect)(() => {
66
66
  if (givingType) {
67
67
  const givingData = givingType === 'single' ? singleGiving : regularGiving;
68
- let moneyBuyNewDescription = otherAmountText;
68
+ let moneyBuyUpdatedDescription = otherAmountText;
69
69
  givingData.moneybuys.map((moneyBuy, index) => {
70
- if (moneyBuy.value === amountDonate) {
71
- moneyBuyNewDescription = moneyBuy.description;
70
+ // Only show the MB-associated copy when we're actually showing moneybuys
71
+ if (moneyBuy.value === amountDonate && !noMoneyBuys) {
72
+ moneyBuyUpdatedDescription = moneyBuy.description;
72
73
  }
73
74
  return index === 1 && amountDonate === undefined && (setMoneyBuyCopy(moneyBuy.description), setAmountDonate(moneyBuy.value));
74
75
  });
@@ -77,10 +78,10 @@ const Signup = _ref => {
77
78
  if (!errorMsg) setErrorMsg(true);
78
79
  } else {
79
80
  if (errorMsg) setErrorMsg(false);
80
- setMoneyBuyCopy(moneyBuyNewDescription);
81
+ setMoneyBuyCopy(moneyBuyUpdatedDescription);
81
82
  }
82
83
  }
83
- }, [errorMsg, moneyBuyCopy, singleGiving, regularGiving, givingType, amountDonate, otherAmountText]);
84
+ }, [errorMsg, moneyBuyCopy, singleGiving, regularGiving, givingType, amountDonate, otherAmountText, noMoneyBuys]);
84
85
 
85
86
  // Updates our flag that differentiates between the popup
86
87
  // being *currently* open and it *ever* having been shown to user
@@ -214,7 +215,7 @@ const Signup = _ref => {
214
215
  onChange: e => setAmountDonate(e.target.value.trim()),
215
216
  "aria-label": "Input a different amount",
216
217
  ref: amountRef
217
- }))), amountDonate >= 1 && !noMoneyBuys && moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_Donate.Copy, {
218
+ }))), amountDonate >= 1 && moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_Donate.Copy, {
218
219
  as: "p"
219
220
  }, /*#__PURE__*/_react.default.createElement("strong", null, "\xA3".concat(amountDonate, " ")), moneyBuyCopy), errorMsg && /*#__PURE__*/_react.default.createElement(_Donate.Error, {
220
221
  className: "error--amount",
@@ -233,6 +234,9 @@ Signup.defaultProps = {
233
234
  data: {},
234
235
  additionalSingleCopy: null,
235
236
  additionalMonthlyCopy: null,
236
- defaultGivingType: null
237
+ defaultGivingType: null,
238
+ monthlyChooseAmountCopy: null,
239
+ monthlyOtherAmountCopy: null,
240
+ givingType: null
237
241
  };
238
242
  var _default = exports.default = Signup;
@@ -239,6 +239,11 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
239
239
  }
240
240
 
241
241
  .c24 {
242
+ line-height: 1.5;
243
+ margin-top: 2rem;
244
+ }
245
+
246
+ .c25 {
242
247
  width: 100%;
243
248
  margin: 2rem 0 2rem;
244
249
  color: #FFFFFF;
@@ -257,9 +262,9 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
257
262
  appearance: none;
258
263
  }
259
264
 
260
- .c24:active,
261
- .c24:focus,
262
- .c24:hover {
265
+ .c25:active,
266
+ .c25:focus,
267
+ .c25:hover {
263
268
  outline: none;
264
269
  background-color: #961D35;
265
270
  }
@@ -492,7 +497,7 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
492
497
  }
493
498
 
494
499
  @media (min-width:740px) {
495
- .c24 {
500
+ .c25 {
496
501
  padding: 1rem 2rem;
497
502
  }
498
503
  }
@@ -514,6 +519,7 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
514
519
  >
515
520
  <div
516
521
  className="c2"
522
+ data-test="this-one-here"
517
523
  >
518
524
  <div
519
525
  className="c3"
@@ -639,8 +645,16 @@ exports[`"Single Giving, No Money Buys, with overridden manual input value" rend
639
645
 
640
646
  </label>
641
647
  </div>
642
- <button
648
+ <p
643
649
  className="c24"
650
+ >
651
+ <strong>
652
+ £345.67
653
+ </strong>
654
+ will help us fund amazing projects in the UK and around the world.
655
+ </p>
656
+ <button
657
+ className="c25"
644
658
  color="red"
645
659
  type="submit"
646
660
  >
@@ -1142,6 +1156,7 @@ exports[`Monthly donation renders correctly 1`] = `
1142
1156
  >
1143
1157
  <div
1144
1158
  className="c2"
1159
+ data-test="this-one-here"
1145
1160
  >
1146
1161
  <div
1147
1162
  className="c3"
@@ -1803,6 +1818,7 @@ exports[`Single donation renders correctly 1`] = `
1803
1818
  >
1804
1819
  <div
1805
1820
  className="c2"
1821
+ data-test="this-one-here"
1806
1822
  >
1807
1823
  <div
1808
1824
  className="c3"
@@ -2256,6 +2272,11 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2256
2272
  }
2257
2273
 
2258
2274
  .c18 {
2275
+ line-height: 1.5;
2276
+ margin-top: 2rem;
2277
+ }
2278
+
2279
+ .c19 {
2259
2280
  width: 100%;
2260
2281
  margin: 2rem 0 2rem;
2261
2282
  color: #FFFFFF;
@@ -2274,9 +2295,9 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2274
2295
  appearance: none;
2275
2296
  }
2276
2297
 
2277
- .c18:active,
2278
- .c18:focus,
2279
- .c18:hover {
2298
+ .c19:active,
2299
+ .c19:focus,
2300
+ .c19:hover {
2280
2301
  outline: none;
2281
2302
  background-color: #961D35;
2282
2303
  }
@@ -2366,7 +2387,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2366
2387
  }
2367
2388
 
2368
2389
  @media (min-width:740px) {
2369
- .c18 {
2390
+ .c19 {
2370
2391
  padding: 1rem 2rem;
2371
2392
  }
2372
2393
  }
@@ -2381,6 +2402,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2381
2402
  >
2382
2403
  <div
2383
2404
  className="c2"
2405
+ data-test="this-one-here"
2384
2406
  >
2385
2407
  <div
2386
2408
  className="c3"
@@ -2463,8 +2485,15 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2463
2485
 
2464
2486
  </label>
2465
2487
  </div>
2466
- <button
2488
+ <p
2467
2489
  className="c18"
2490
+ >
2491
+ <strong>
2492
+ £10
2493
+ </strong>
2494
+ </p>
2495
+ <button
2496
+ className="c19"
2468
2497
  color="red"
2469
2498
  type="submit"
2470
2499
  >
@@ -7,9 +7,13 @@ exports.handleTitles = exports.handleCopy = void 0;
7
7
  const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
8
8
  let thisTitle;
9
9
  let thisSubtitle;
10
+ const showSingleCopy = Boolean(subtitle) && Boolean(title);
10
11
  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);
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;
13
17
 
14
18
  // Apply the override if we've got monthly content AND giving type:
15
19
  if (showMonthlyCopy) {
@@ -23,7 +27,8 @@ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle
23
27
  return {
24
28
  showCopy,
25
29
  thisTitle,
26
- thisSubtitle
30
+ thisSubtitle,
31
+ noTitlesAtAll
27
32
  };
28
33
  };
29
34
  exports.handleTitles = handleTitles;
@@ -27,6 +27,7 @@ const colors = {
27
27
  green_light: '#F4F2F4',
28
28
  grey: '#969598',
29
29
  grey_dark: '#222222',
30
+ grey_stone: '#CEDCDA',
30
31
  grey_extra_light: '#f0f0f0',
31
32
  grey_for_forms: '#666',
32
33
  grey_label: '#5C5C5E',
@@ -43,6 +44,7 @@ const colors = {
43
44
  purple_dark: '#48276E',
44
45
  purple_light: '#DFC6F6',
45
46
  red: '#E52630',
47
+ red_secondary: '#F9723A',
46
48
  red_dark: '#890B11',
47
49
  rnd_23_teal: '#3EB1AA',
48
50
  rnd_23_yellow: '#FFE300',
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.29.0",
4
+ "version": "7.31.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -24,6 +24,7 @@
24
24
  "@babel/cli": "^7.21.5",
25
25
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
26
26
  "@hookform/resolvers": "^1.3.4",
27
+ "@playwright/test": "^1.38.1",
27
28
  "axios": "^0.21.1",
28
29
  "ejs": "^3.1.9",
29
30
  "jest-styled-components": "^7.1.1",
@@ -53,6 +54,7 @@
53
54
  },
54
55
  "scripts": {
55
56
  "test:unit": "yarn run jest",
57
+ "test:unit-update": "yarn jest -u",
56
58
  "styleguide": "cross-env FAST_REFRESH=false styleguidist server",
57
59
  "styleguide:build": "styleguidist build",
58
60
  "postinstall": "yarn run build",
@@ -77,7 +79,6 @@
77
79
  ]
78
80
  },
79
81
  "devDependencies": {
80
- "@playwright/test": "^1.38.1",
81
82
  "cross-env": "^7.0.3",
82
83
  "eslint": "^7.32.0",
83
84
  "eslint-config-airbnb": "^18.2.0",