@comicrelief/component-library 7.29.0 → 7.30.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 +2 -2
- package/dist/components/Organisms/Donate/Donate.js +12 -9
- package/dist/components/Organisms/Donate/Donate.md +27 -21
- package/dist/components/Organisms/Donate/Donate.style.js +37 -33
- package/dist/components/Organisms/Donate/Form/Form.js +11 -7
- package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +39 -10
- package/dist/components/Organisms/Donate/_utils.js +8 -3
- package/package.json +3 -2
- package/playwright/components/organisms/donate.spec.js +73 -79
- package/src/components/Organisms/Donate/Donate.js +33 -27
- package/src/components/Organisms/Donate/Donate.md +27 -21
- package/src/components/Organisms/Donate/Donate.style.js +12 -6
- package/src/components/Organisms/Donate/Form/Form.js +15 -10
- package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +39 -10
- package/src/components/Organisms/Donate/_utils.js +9 -3
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
// import styled, { css } from 'styled-components';
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
3
2
|
|
|
4
3
|
import Input from '../../Atoms/Input/Input';
|
|
5
4
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -48,7 +47,14 @@ const Wrapper = styled.div`
|
|
|
48
47
|
align-items: center;
|
|
49
48
|
display: block;
|
|
50
49
|
width: 100%;
|
|
50
|
+
// TO-DO: this condition is WRONG and needs fixing (should be 'false'), but deploy this change will
|
|
51
|
+
// require a lot of content updates down the line in order to bring the pages back to the desired layout
|
|
51
52
|
flex-direction: ${({ formAlignRight }) => (formAlignRight === true ? 'row-reverse' : 'row')};
|
|
53
|
+
|
|
54
|
+
${({ noTitlesAtAll }) => noTitlesAtAll === true && css`
|
|
55
|
+
justify-content: center;
|
|
56
|
+
`};
|
|
57
|
+
|
|
52
58
|
${media('small')} {
|
|
53
59
|
padding: ${spacing('xl')} ${spacing('md')};
|
|
54
60
|
}
|
|
@@ -58,7 +64,7 @@ const Wrapper = styled.div`
|
|
|
58
64
|
}
|
|
59
65
|
`;
|
|
60
66
|
|
|
61
|
-
const
|
|
67
|
+
const TitleWrapperOuter = styled.div`
|
|
62
68
|
width: 100%;
|
|
63
69
|
display: flex;
|
|
64
70
|
font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
|
|
@@ -69,7 +75,7 @@ const Header = styled.div`
|
|
|
69
75
|
}
|
|
70
76
|
`;
|
|
71
77
|
|
|
72
|
-
const
|
|
78
|
+
const TitleWrapperInner = styled.div`
|
|
73
79
|
position: relative;
|
|
74
80
|
text-align: left;
|
|
75
81
|
`;
|
|
@@ -243,8 +249,8 @@ export {
|
|
|
243
249
|
Error,
|
|
244
250
|
FormFieldset,
|
|
245
251
|
FormWrapper,
|
|
246
|
-
|
|
247
|
-
|
|
252
|
+
TitleWrapperInner,
|
|
253
|
+
TitleWrapperOuter,
|
|
248
254
|
Label,
|
|
249
255
|
Wrapper,
|
|
250
256
|
Form,
|
|
@@ -80,11 +80,12 @@ const Signup = ({
|
|
|
80
80
|
if (givingType) {
|
|
81
81
|
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
82
82
|
|
|
83
|
-
let
|
|
83
|
+
let moneyBuyUpdatedDescription = otherAmountText;
|
|
84
84
|
|
|
85
85
|
givingData.moneybuys.map((moneyBuy, index) => {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// Only show the MB-associated copy when we're actually showing moneybuys
|
|
87
|
+
if (moneyBuy.value === amountDonate && !noMoneyBuys) {
|
|
88
|
+
moneyBuyUpdatedDescription = moneyBuy.description;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
return (
|
|
@@ -100,7 +101,7 @@ const Signup = ({
|
|
|
100
101
|
if (!errorMsg) setErrorMsg(true);
|
|
101
102
|
} else {
|
|
102
103
|
if (errorMsg) setErrorMsg(false);
|
|
103
|
-
setMoneyBuyCopy(
|
|
104
|
+
setMoneyBuyCopy(moneyBuyUpdatedDescription);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
}, [
|
|
@@ -110,7 +111,8 @@ const Signup = ({
|
|
|
110
111
|
regularGiving,
|
|
111
112
|
givingType,
|
|
112
113
|
amountDonate,
|
|
113
|
-
otherAmountText
|
|
114
|
+
otherAmountText,
|
|
115
|
+
noMoneyBuys
|
|
114
116
|
]);
|
|
115
117
|
|
|
116
118
|
// Updates our flag that differentiates between the popup
|
|
@@ -292,7 +294,7 @@ const Signup = ({
|
|
|
292
294
|
ref={amountRef}
|
|
293
295
|
/>
|
|
294
296
|
</FormFieldset>
|
|
295
|
-
{amountDonate >= 1 &&
|
|
297
|
+
{amountDonate >= 1 && moneyBuyCopy && (
|
|
296
298
|
<Copy as="p">
|
|
297
299
|
<strong>{`£${amountDonate} `}</strong>
|
|
298
300
|
{moneyBuyCopy}
|
|
@@ -343,10 +345,10 @@ Signup.propTypes = {
|
|
|
343
345
|
additionalSingleCopy: PropTypes.string,
|
|
344
346
|
additionalMonthlyCopy: PropTypes.string,
|
|
345
347
|
defaultGivingType: PropTypes.string,
|
|
346
|
-
monthlyChooseAmountCopy: PropTypes.string
|
|
347
|
-
monthlyOtherAmountCopy: PropTypes.string
|
|
348
|
+
monthlyChooseAmountCopy: PropTypes.string,
|
|
349
|
+
monthlyOtherAmountCopy: PropTypes.string,
|
|
348
350
|
changeGivingType: PropTypes.func.isRequired,
|
|
349
|
-
givingType: PropTypes.string
|
|
351
|
+
givingType: PropTypes.string
|
|
350
352
|
};
|
|
351
353
|
|
|
352
354
|
Signup.defaultProps = {
|
|
@@ -355,7 +357,10 @@ Signup.defaultProps = {
|
|
|
355
357
|
data: {},
|
|
356
358
|
additionalSingleCopy: null,
|
|
357
359
|
additionalMonthlyCopy: null,
|
|
358
|
-
defaultGivingType: null
|
|
360
|
+
defaultGivingType: null,
|
|
361
|
+
monthlyChooseAmountCopy: null,
|
|
362
|
+
monthlyOtherAmountCopy: null,
|
|
363
|
+
givingType: null
|
|
359
364
|
};
|
|
360
365
|
|
|
361
366
|
export 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
|
-
.
|
|
261
|
-
.
|
|
262
|
-
.
|
|
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
|
-
.
|
|
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
|
-
<
|
|
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
|
-
.
|
|
2278
|
-
.
|
|
2279
|
-
.
|
|
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
|
-
.
|
|
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
|
-
<
|
|
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
|
>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle) => {
|
|
2
2
|
let thisTitle; let thisSubtitle;
|
|
3
|
+
const showSingleCopy = Boolean(subtitle) && Boolean(title);
|
|
3
4
|
const showMonthlyCopy = givingType === 'monthly' && Boolean(monthlySubtitle) && Boolean(monthlyTitle);
|
|
4
|
-
// Overall flag as to whether we render copy
|
|
5
|
-
const showCopy = showMonthlyCopy ||
|
|
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;
|
|
6
10
|
|
|
7
11
|
// Apply the override if we've got monthly content AND giving type:
|
|
8
12
|
if (showMonthlyCopy) {
|
|
@@ -14,7 +18,9 @@ const handleTitles = (givingType, title, subtitle, monthlyTitle, monthlySubtitle
|
|
|
14
18
|
thisSubtitle = subtitle;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
showCopy, thisTitle, thisSubtitle, noTitlesAtAll
|
|
23
|
+
};
|
|
18
24
|
};
|
|
19
25
|
|
|
20
26
|
const handleCopy = (gType, otherAmount, chooseAmount, monthlyOtherAmount, monthlyChooseAmount) => {
|