@comicrelief/component-library 7.0.0 → 7.0.2
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/cypress/integration/components/Organisms/Donate.spec.js +28 -28
- package/cypress/integration/components/Organisms/Membership.spec.js +118 -120
- package/dist/components/Organisms/Donate/Donate.md +9 -9
- package/dist/components/Organisms/Donate/Form/Form.js +8 -6
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +17 -71
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +71 -0
- package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +14 -28
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +1 -0
- package/dist/components/Organisms/Membership/Form/Form.js +4 -3
- package/dist/components/Organisms/Membership/Membership.test.js +1 -1
- package/dist/utils/Membership.js +1 -1
- package/package.json +1 -1
- package/src/components/Organisms/Donate/Donate.md +9 -9
- package/src/components/Organisms/Donate/Form/Form.js +11 -7
- package/src/components/Organisms/Donate/GivingSelector/GivingSelector.js +15 -85
- package/src/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +78 -0
- package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +14 -28
- package/src/components/Organisms/EmailSignUp/EmailSignUpForm.js +1 -0
- package/src/components/Organisms/Membership/Form/Form.js +3 -3
- package/src/components/Organisms/Membership/Membership.test.js +1 -1
- package/src/utils/Membership.js +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Label = exports.MoneyBox = exports.Wrapper = exports.Switch = void 0;
|
|
9
|
+
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
|
|
12
|
+
var _size = require("../../../../theme/shared/size");
|
|
13
|
+
|
|
14
|
+
var _spacing = _interopRequireDefault(require("../../../../theme/shared/spacing"));
|
|
15
|
+
|
|
16
|
+
var _zIndex = _interopRequireDefault(require("../../../../theme/shared/zIndex"));
|
|
17
|
+
|
|
18
|
+
var _hideVisually = _interopRequireDefault(require("../../../../theme/shared/hideVisually"));
|
|
19
|
+
|
|
20
|
+
var Switch = _styledComponents.default.span.withConfig({
|
|
21
|
+
displayName: "GivingSelectorstyle__Switch",
|
|
22
|
+
componentId: "sc-5ktn9c-0"
|
|
23
|
+
})(["width:50%;height:48px;border-radius:2rem;", ";display:block;position:absolute;transition:left 0.15s ease-out;background-color:", ";left:2px;box-shadow:0px 0px 16px rgba(0,0,0,0.3);"], (0, _zIndex.default)('low'), function (_ref) {
|
|
24
|
+
var theme = _ref.theme;
|
|
25
|
+
return theme.color('blue');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.Switch = Switch;
|
|
29
|
+
|
|
30
|
+
var Wrapper = _styledComponents.default.div.withConfig({
|
|
31
|
+
displayName: "GivingSelectorstyle__Wrapper",
|
|
32
|
+
componentId: "sc-5ktn9c-1"
|
|
33
|
+
})(["display:flex;margin:", " 0;"], (0, _spacing.default)('md'));
|
|
34
|
+
|
|
35
|
+
exports.Wrapper = Wrapper;
|
|
36
|
+
|
|
37
|
+
var MoneyBox = _styledComponents.default.div.withConfig({
|
|
38
|
+
displayName: "GivingSelectorstyle__MoneyBox",
|
|
39
|
+
componentId: "sc-5ktn9c-2"
|
|
40
|
+
})(["width:100%;padding:2px;position:relative;display:flex;flex-direction:row;margin:", " 0;border-radius:2rem;background:", ";", "{width:450px;margin:0 auto;}.give-monthly:checked ~ ", "{left:calc(50% - 2px);}input{", "}input:focus:not(:checked) + label{box-shadow:inset 0 0 0 4px ", ";}"], (0, _spacing.default)('md'), function (_ref2) {
|
|
41
|
+
var theme = _ref2.theme;
|
|
42
|
+
return theme.color('blue_light');
|
|
43
|
+
}, (0, _size.media)('small'), Switch, _hideVisually.default, function (_ref3) {
|
|
44
|
+
var theme = _ref3.theme;
|
|
45
|
+
return theme.color('blue');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
exports.MoneyBox = MoneyBox;
|
|
49
|
+
|
|
50
|
+
var Label = _styledComponents.default.label.withConfig({
|
|
51
|
+
displayName: "GivingSelectorstyle__Label",
|
|
52
|
+
componentId: "sc-5ktn9c-3"
|
|
53
|
+
})(["font-size:", ";font-family:", ";font-weight:bold;min-height:48px;align-items:center;justify-content:center;display:flex;flex-basis:50%;border:none;transition:color 0.15s ease-out;", ";cursor:", ";border-radius:2rem;color:", ";&:active:focus{box-shadow:none;}&:focus{border:none;outline:none;box-shadow:inset 0 0 0 4px ", ";}"], function (_ref4) {
|
|
54
|
+
var theme = _ref4.theme;
|
|
55
|
+
return theme.fontSize('s');
|
|
56
|
+
}, function (_ref5) {
|
|
57
|
+
var theme = _ref5.theme;
|
|
58
|
+
return theme.fontFamilies('Montserrat');
|
|
59
|
+
}, (0, _zIndex.default)('medium'), function (_ref6) {
|
|
60
|
+
var active = _ref6.active;
|
|
61
|
+
return active === true ? 'default' : 'pointer';
|
|
62
|
+
}, function (_ref7) {
|
|
63
|
+
var active = _ref7.active,
|
|
64
|
+
theme = _ref7.theme;
|
|
65
|
+
return active === true ? theme.color('white') : theme.color('black');
|
|
66
|
+
}, function (_ref8) {
|
|
67
|
+
var theme = _ref8.theme;
|
|
68
|
+
return theme.color('blue');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
exports.Label = Label;
|
|
@@ -367,7 +367,7 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
367
367
|
background: #BECCF9;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
.c8
|
|
370
|
+
.c8 .give-monthly:checked ~ .c11 {
|
|
371
371
|
left: calc(50% - 2px);
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -415,6 +415,8 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
415
415
|
transition: color 0.15s ease-out;
|
|
416
416
|
z-index: 2;
|
|
417
417
|
cursor: default;
|
|
418
|
+
border-radius: 2rem;
|
|
419
|
+
color: #FFFFFF;
|
|
418
420
|
}
|
|
419
421
|
|
|
420
422
|
.c9:active:focus {
|
|
@@ -427,16 +429,6 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
427
429
|
box-shadow: inset 0 0 0 4px #0565D1;
|
|
428
430
|
}
|
|
429
431
|
|
|
430
|
-
.c9[for='give-once'] {
|
|
431
|
-
border-radius: 2rem;
|
|
432
|
-
color: #FFFFFF;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
.c9[for='give-monthly'] {
|
|
436
|
-
border-radius: 2rem;
|
|
437
|
-
color: #FFFFFF;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
432
|
.c10 {
|
|
441
433
|
font-size: 1rem;
|
|
442
434
|
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
@@ -462,6 +454,8 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
462
454
|
transition: color 0.15s ease-out;
|
|
463
455
|
z-index: 2;
|
|
464
456
|
cursor: pointer;
|
|
457
|
+
border-radius: 2rem;
|
|
458
|
+
color: #000000;
|
|
465
459
|
}
|
|
466
460
|
|
|
467
461
|
.c10:active:focus {
|
|
@@ -474,16 +468,6 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
474
468
|
box-shadow: inset 0 0 0 4px #0565D1;
|
|
475
469
|
}
|
|
476
470
|
|
|
477
|
-
.c10[for='give-once'] {
|
|
478
|
-
border-radius: 2rem;
|
|
479
|
-
color: #000000;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.c10[for='give-monthly'] {
|
|
483
|
-
border-radius: 2rem;
|
|
484
|
-
color: #000000;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
471
|
@media (min-width:740px) {
|
|
488
472
|
.c5 {
|
|
489
473
|
font-size: 1.25rem;
|
|
@@ -644,8 +628,9 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
644
628
|
<input
|
|
645
629
|
aria-label="Single"
|
|
646
630
|
checked={true}
|
|
631
|
+
className="give-once"
|
|
647
632
|
errormsg=""
|
|
648
|
-
id="give-once"
|
|
633
|
+
id="give-once--mship-1"
|
|
649
634
|
label=""
|
|
650
635
|
onClick={[Function]}
|
|
651
636
|
type="radio"
|
|
@@ -653,15 +638,16 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
653
638
|
/>
|
|
654
639
|
<label
|
|
655
640
|
className="c9"
|
|
656
|
-
htmlFor="give-once"
|
|
641
|
+
htmlFor="give-once--mship-1"
|
|
657
642
|
>
|
|
658
643
|
Single
|
|
659
644
|
</label>
|
|
660
645
|
<input
|
|
661
646
|
aria-label="Monthly"
|
|
662
647
|
checked={false}
|
|
648
|
+
className="give-monthly"
|
|
663
649
|
errormsg=""
|
|
664
|
-
id="give-monthly"
|
|
650
|
+
id="give-monthly--mship-1"
|
|
665
651
|
label=""
|
|
666
652
|
onClick={[Function]}
|
|
667
653
|
type="radio"
|
|
@@ -669,7 +655,7 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
669
655
|
/>
|
|
670
656
|
<label
|
|
671
657
|
className="c10"
|
|
672
|
-
htmlFor="give-monthly"
|
|
658
|
+
htmlFor="give-monthly--mship-1"
|
|
673
659
|
>
|
|
674
660
|
Monthly
|
|
675
661
|
</label>
|
|
@@ -832,7 +818,7 @@ exports[`Monthly donation renders correctly 1`] = `
|
|
|
832
818
|
aria-label="Input a different amount"
|
|
833
819
|
className="c23"
|
|
834
820
|
id="mship-1--MoneyBuy-userInput"
|
|
835
|
-
max="
|
|
821
|
+
max="25000"
|
|
836
822
|
min="1"
|
|
837
823
|
name="membership_amount"
|
|
838
824
|
onChange={[Function]}
|
|
@@ -1535,7 +1521,7 @@ exports[`Single donation renders correctly 1`] = `
|
|
|
1535
1521
|
aria-label="Input a different amount"
|
|
1536
1522
|
className="c17"
|
|
1537
1523
|
id="mship-1--MoneyBuy-userInput"
|
|
1538
|
-
max="
|
|
1524
|
+
max="25000"
|
|
1539
1525
|
min="1"
|
|
1540
1526
|
name="membership_amount"
|
|
1541
1527
|
onChange={[Function]}
|
|
@@ -2001,7 +1987,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
|
|
|
2001
1987
|
aria-label="Input a different amount"
|
|
2002
1988
|
className="c17"
|
|
2003
1989
|
id="mship-1--MoneyBuy-userInput"
|
|
2004
|
-
max="
|
|
1990
|
+
max="25000"
|
|
2005
1991
|
min="1"
|
|
2006
1992
|
name="membership_amount"
|
|
2007
1993
|
onChange={[Function]}
|
|
@@ -194,7 +194,7 @@ var Signup = function Signup(_ref) {
|
|
|
194
194
|
id: "".concat(mbshipID, "--MoneyBuy-userInput"),
|
|
195
195
|
showLabel: true
|
|
196
196
|
}, rest, {
|
|
197
|
-
max: "
|
|
197
|
+
max: "25000",
|
|
198
198
|
min: "1",
|
|
199
199
|
value: userInput,
|
|
200
200
|
pattern: "[^[0-9]+([,.][0-9]+)?$]",
|
|
@@ -214,8 +214,9 @@ var Signup = function Signup(_ref) {
|
|
|
214
214
|
type: "submit",
|
|
215
215
|
value: "Donate"
|
|
216
216
|
}), errorMsg && /*#__PURE__*/_react.default.createElement(_Membership2.Error, {
|
|
217
|
-
tag: "p"
|
|
218
|
-
|
|
217
|
+
tag: "p",
|
|
218
|
+
className: "error--amount"
|
|
219
|
+
}, "Please enter a number between 1 and 25000, and up to 2 decimal places"), moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_Membership2.Copy, {
|
|
219
220
|
as: "p"
|
|
220
221
|
}, moneyBuyCopy))));
|
|
221
222
|
};
|
|
@@ -29,5 +29,5 @@ it("renders correctly", function () {
|
|
|
29
29
|
subtitle: "Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.",
|
|
30
30
|
otherDescription: "Your donation will help us fund amazing projects in the UK and around the world."
|
|
31
31
|
})).toJSON();
|
|
32
|
-
expect(tree).toMatchInlineSnapshot("\n .c6 {\n font-size: 1.5rem;\n line-height: 1.5rem;\n text-transform: inherit;\n font-weight: 800;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c7 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c12 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c16 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: bold;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c22 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: 500;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c1 {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .c3 {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n }\n\n .c14 {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n color: #5C5C5E;\n width: 100%;\n }\n\n .c17 {\n margin-bottom: 0.5rem;\n }\n\n .c19 {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n padding: 1rem 1.5rem;\n background-color: #F4F3F5;\n border: 1px solid;\n border-color: #E1E2E3;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n color: #000000;\n border-radius: 0.5rem;\n font-size: inherit;\n z-index: 2;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c19:focus {\n border: 1px solid #666;\n }\n\n .c18 {\n position: relative;\n font-size: 1.25rem;\n }\n\n .c15 {\n display: block;\n }\n\n .c15 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n }\n\n .c20 {\n display: block;\n }\n\n .c20 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n border-color: #E52630;\n background-color: #E52630;\n color: #FFFFFF;\n }\n\n .c0 {\n background-color: #FEE3CC;\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 100vh;\n }\n\n .c2 {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: auto;\n }\n\n .c2:before {\n color: #FEE3CC;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n box-shadow: inset 0px 4rem 2rem -2rem;\n }\n\n .c4 {\n position: relative;\n max-width: 320px;\n text-align: center;\n margin-bottom: 50%;\n }\n\n .c5 {\n padding: 2rem 1rem 0;\n margin-bottom: 2rem;\n }\n\n .c8 {\n background-color: #FFFFFF;\n box-shadow: 0px 1rem 4rem rgba(0,0,0,0.3);\n height: 450px;\n }\n\n .c9 {\n padding: 1rem;\n }\n\n .c9 h3 {\n margin-top: 1rem;\n }\n\n .c9 input {\n max-width: 100%;\n margin: 0;\n }\n\n .c10 {\n padding: 0;\n margin: 0;\n border: none;\n }\n\n .c10 >:not(:last-child):not(legend) {\n margin-bottom: 2rem;\n }\n\n .c11 {\n margin: 0;\n padding: 0;\n }\n\n .c13 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n }\n\n .c13 label {\n -webkit-flex: 0 0 30%;\n -ms-flex: 0 0 30%;\n flex: 0 0 30%;\n }\n\n .c13 label input {\n cursor: pointer;\n padding: 1rem;\n }\n\n .c13 label:hover input {\n border-color: #E52630;\n }\n\n .c21 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .c23 {\n margin-right: auto;\n }\n\n .c24 {\n position: relative;\n -webkit-flex: 0 0 50%;\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n font-weight: 400;\n display: block;\n }\n\n .c24 span {\n position: absolute;\n padding: 0px 15px;\n font-size: 20px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n left: 0px;\n font-weight: 500;\n }\n\n .c24 input {\n border: 2px solid #E1E2E3;\n background: transparent;\n padding: 0.5rem 1rem 0.5rem 2rem;\n }\n\n .c24 input:focus {\n border: 2px solid #E52630;\n }\n\n .c26 {\n line-height: 1.5;\n }\n\n .c25 {\n width: 100%;\n color: #FFFFFF;\n font-size: 1rem;\n font-weight: bold;\n cursor: pointer;\n padding: 1rem 0.5rem;\n background: #E52630;\n border: none;\n border-radius: 100px;\n }\n\n .c25:active,\n .c25:focus,\n .c25:hover {\n background-color: #961D35;\n }\n\n @media (min-width:740px) {\n .c19 {\n max-width: 290px;\n }\n }\n\n @media (min-width:1024px) {\n .c0 {\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: inherit;\n -webkit-justify-content: inherit;\n -ms-flex-pack: inherit;\n justify-content: inherit;\n min-height: 750px;\n height: 100vh;\n max-height: 900px;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n }\n\n @media (min-width:1024px) {\n .c2 {\n height: 100%;\n }\n\n .c2:before {\n content: none;\n }\n }\n\n @media (min-width:1024px) {\n .c4 {\n margin: 0 8rem;\n max-width: 420px;\n }\n }\n\n @media (min-width:1024px) {\n .c8 {\n height: 430px;\n }\n }\n\n @media (min-width:1024px) {\n .c24 {\n -webkit-flex: 0 0 60%;\n -ms-flex: 0 0 60%;\n flex: 0 0 60%;\n }\n }\n\n @media (min-width:1024px) {\n .c25 {\n width: auto;\n padding: 1rem 2rem;\n margin: 0 auto 2rem;\n }\n }\n\n <div\n className=\"c0\"\n id=\"mship-1\"\n >\n <div\n className=\"c1 c2\"\n height=\"100%\"\n width=\"100%\"\n >\n <img\n alt=\"Background image\"\n className=\"c3 lazyload\"\n data-src={null}\n height=\"100%\"\n width=\"100%\"\n />\n </div>\n <div\n className=\"c4\"\n >\n <div\n className=\"c5\"\n >\n <h2\n className=\"c6\"\n color=\"inherit\"\n size=\"l\"\n >\n Help someone like Jordan see a better tomorrow\n </h2>\n <p\n className=\"c7\"\n color=\"inherit\"\n size=\"s\"\n >\n Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.\n </p>\n </div>\n <div\n className=\"c8\"\n >\n <form\n className=\"c9\"\n onSubmit={[Function]}\n >\n <fieldset\n className=\"c10\"\n >\n <legend\n className=\"c11\"\n >\n <h3\n className=\"c12\"\n color=\"inherit\"\n size=\"s\"\n >\n Choose your monthly donation\n </h3>\n </legend>\n <div\n className=\"c13\"\n >\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box1\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box1\"\n aria-label=\"\xA35\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box1\"\n name=\"mship-1--moneyBuy1\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 5\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c20\"\n htmlFor=\"mship-1--moneyBuy-box2\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box2\"\n aria-label=\"\xA310\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box2\"\n name=\"mship-1--moneyBuy2\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 10\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box3\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box3\"\n aria-label=\"\xA320\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box3\"\n name=\"mship-1--moneyBuy3\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 20\"\n />\n </div>\n \n </label>\n </div>\n <div\n className=\"c21\"\n >\n <span\n className=\"c22 c23\"\n color=\"inherit\"\n size=\"s\"\n >\n Other amount\n </span>\n <label\n className=\"c14 c24\"\n htmlFor=\"mship-1--MoneyBuy-userInput\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\xA3\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--MoneyBuy-userInput\"\n aria-label=\"Input a different amount\"\n className=\"c19\"\n id=\"mship-1--MoneyBuy-userInput\"\n max=\"20000\"\n min=\"1\"\n name=\"membership_amount\"\n onChange={[Function]}\n onClick={[Function]}\n onKeyPress={[Function]}\n pattern=\"[^[0-9]+([,.][0-9]+)?$]\"\n placeholder=\"0.00\"\n required={false}\n step=\"0.01\"\n type=\"number\"\n value=\"\"\n />\n </div>\n \n </label>\n </div>\n <input\n className=\"c25\"\n type=\"submit\"\n value=\"Donate\"\n />\n <p\n className=\"c26\"\n />\n </fieldset>\n </form>\n </div>\n </div>\n </div>\n ");
|
|
32
|
+
expect(tree).toMatchInlineSnapshot("\n .c6 {\n font-size: 1.5rem;\n line-height: 1.5rem;\n text-transform: inherit;\n font-weight: 800;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c7 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c12 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c16 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: bold;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c22 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: 500;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c1 {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .c3 {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n }\n\n .c14 {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n color: #5C5C5E;\n width: 100%;\n }\n\n .c17 {\n margin-bottom: 0.5rem;\n }\n\n .c19 {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n padding: 1rem 1.5rem;\n background-color: #F4F3F5;\n border: 1px solid;\n border-color: #E1E2E3;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n color: #000000;\n border-radius: 0.5rem;\n font-size: inherit;\n z-index: 2;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c19:focus {\n border: 1px solid #666;\n }\n\n .c18 {\n position: relative;\n font-size: 1.25rem;\n }\n\n .c15 {\n display: block;\n }\n\n .c15 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n }\n\n .c20 {\n display: block;\n }\n\n .c20 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n border-color: #E52630;\n background-color: #E52630;\n color: #FFFFFF;\n }\n\n .c0 {\n background-color: #FEE3CC;\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 100vh;\n }\n\n .c2 {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: auto;\n }\n\n .c2:before {\n color: #FEE3CC;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n box-shadow: inset 0px 4rem 2rem -2rem;\n }\n\n .c4 {\n position: relative;\n max-width: 320px;\n text-align: center;\n margin-bottom: 50%;\n }\n\n .c5 {\n padding: 2rem 1rem 0;\n margin-bottom: 2rem;\n }\n\n .c8 {\n background-color: #FFFFFF;\n box-shadow: 0px 1rem 4rem rgba(0,0,0,0.3);\n height: 450px;\n }\n\n .c9 {\n padding: 1rem;\n }\n\n .c9 h3 {\n margin-top: 1rem;\n }\n\n .c9 input {\n max-width: 100%;\n margin: 0;\n }\n\n .c10 {\n padding: 0;\n margin: 0;\n border: none;\n }\n\n .c10 >:not(:last-child):not(legend) {\n margin-bottom: 2rem;\n }\n\n .c11 {\n margin: 0;\n padding: 0;\n }\n\n .c13 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n }\n\n .c13 label {\n -webkit-flex: 0 0 30%;\n -ms-flex: 0 0 30%;\n flex: 0 0 30%;\n }\n\n .c13 label input {\n cursor: pointer;\n padding: 1rem;\n }\n\n .c13 label:hover input {\n border-color: #E52630;\n }\n\n .c21 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .c23 {\n margin-right: auto;\n }\n\n .c24 {\n position: relative;\n -webkit-flex: 0 0 50%;\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n font-weight: 400;\n display: block;\n }\n\n .c24 span {\n position: absolute;\n padding: 0px 15px;\n font-size: 20px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n left: 0px;\n font-weight: 500;\n }\n\n .c24 input {\n border: 2px solid #E1E2E3;\n background: transparent;\n padding: 0.5rem 1rem 0.5rem 2rem;\n }\n\n .c24 input:focus {\n border: 2px solid #E52630;\n }\n\n .c26 {\n line-height: 1.5;\n }\n\n .c25 {\n width: 100%;\n color: #FFFFFF;\n font-size: 1rem;\n font-weight: bold;\n cursor: pointer;\n padding: 1rem 0.5rem;\n background: #E52630;\n border: none;\n border-radius: 100px;\n }\n\n .c25:active,\n .c25:focus,\n .c25:hover {\n background-color: #961D35;\n }\n\n @media (min-width:740px) {\n .c19 {\n max-width: 290px;\n }\n }\n\n @media (min-width:1024px) {\n .c0 {\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: inherit;\n -webkit-justify-content: inherit;\n -ms-flex-pack: inherit;\n justify-content: inherit;\n min-height: 750px;\n height: 100vh;\n max-height: 900px;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n }\n\n @media (min-width:1024px) {\n .c2 {\n height: 100%;\n }\n\n .c2:before {\n content: none;\n }\n }\n\n @media (min-width:1024px) {\n .c4 {\n margin: 0 8rem;\n max-width: 420px;\n }\n }\n\n @media (min-width:1024px) {\n .c8 {\n height: 430px;\n }\n }\n\n @media (min-width:1024px) {\n .c24 {\n -webkit-flex: 0 0 60%;\n -ms-flex: 0 0 60%;\n flex: 0 0 60%;\n }\n }\n\n @media (min-width:1024px) {\n .c25 {\n width: auto;\n padding: 1rem 2rem;\n margin: 0 auto 2rem;\n }\n }\n\n <div\n className=\"c0\"\n id=\"mship-1\"\n >\n <div\n className=\"c1 c2\"\n height=\"100%\"\n width=\"100%\"\n >\n <img\n alt=\"Background image\"\n className=\"c3 lazyload\"\n data-src={null}\n height=\"100%\"\n width=\"100%\"\n />\n </div>\n <div\n className=\"c4\"\n >\n <div\n className=\"c5\"\n >\n <h2\n className=\"c6\"\n color=\"inherit\"\n size=\"l\"\n >\n Help someone like Jordan see a better tomorrow\n </h2>\n <p\n className=\"c7\"\n color=\"inherit\"\n size=\"s\"\n >\n Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.\n </p>\n </div>\n <div\n className=\"c8\"\n >\n <form\n className=\"c9\"\n onSubmit={[Function]}\n >\n <fieldset\n className=\"c10\"\n >\n <legend\n className=\"c11\"\n >\n <h3\n className=\"c12\"\n color=\"inherit\"\n size=\"s\"\n >\n Choose your monthly donation\n </h3>\n </legend>\n <div\n className=\"c13\"\n >\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box1\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box1\"\n aria-label=\"\xA35\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box1\"\n name=\"mship-1--moneyBuy1\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 5\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c20\"\n htmlFor=\"mship-1--moneyBuy-box2\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box2\"\n aria-label=\"\xA310\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box2\"\n name=\"mship-1--moneyBuy2\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 10\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box3\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box3\"\n aria-label=\"\xA320\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box3\"\n name=\"mship-1--moneyBuy3\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 20\"\n />\n </div>\n \n </label>\n </div>\n <div\n className=\"c21\"\n >\n <span\n className=\"c22 c23\"\n color=\"inherit\"\n size=\"s\"\n >\n Other amount\n </span>\n <label\n className=\"c14 c24\"\n htmlFor=\"mship-1--MoneyBuy-userInput\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\xA3\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--MoneyBuy-userInput\"\n aria-label=\"Input a different amount\"\n className=\"c19\"\n id=\"mship-1--MoneyBuy-userInput\"\n max=\"25000\"\n min=\"1\"\n name=\"membership_amount\"\n onChange={[Function]}\n onClick={[Function]}\n onKeyPress={[Function]}\n pattern=\"[^[0-9]+([,.][0-9]+)?$]\"\n placeholder=\"0.00\"\n required={false}\n step=\"0.01\"\n type=\"number\"\n value=\"\"\n />\n </div>\n \n </label>\n </div>\n <input\n className=\"c25\"\n type=\"submit\"\n value=\"Donate\"\n />\n <p\n className=\"c26\"\n />\n </fieldset>\n </form>\n </div>\n </div>\n </div>\n ");
|
|
33
33
|
});
|
package/dist/utils/Membership.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.onKeyPress = onKeyPress;
|
|
|
16
16
|
|
|
17
17
|
var isAmountValid = function isAmountValid(input) {
|
|
18
18
|
var reg = /^\s*(?=.*[1-9])\d*(?:\.\d{1,2})?\s*$/g;
|
|
19
|
-
var isValid = input * 1 >= 1 && input * 1 <=
|
|
19
|
+
var isValid = input * 1 >= 1 && input * 1 <= 25000 && reg.test(input);
|
|
20
20
|
return isValid;
|
|
21
21
|
};
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
41
41
|
mobileImageLow={mobilePictures.imageLow}
|
|
42
42
|
mobileImages={mobilePictures.images}
|
|
43
43
|
data={data}
|
|
44
|
-
mbshipID="mship-
|
|
44
|
+
mbshipID="mship-2"
|
|
45
45
|
donateLink="https://donation.comicrelief.com/"
|
|
46
46
|
clientID="donate"
|
|
47
47
|
cartID="default-comicrelief"
|
|
@@ -66,7 +66,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
66
66
|
mobileImageLow={mobilePictures.imageLow}
|
|
67
67
|
mobileImages={mobilePictures.images}
|
|
68
68
|
data={data}
|
|
69
|
-
mbshipID="mship-
|
|
69
|
+
mbshipID="mship-3"
|
|
70
70
|
donateLink="https://donation.comicrelief.com/"
|
|
71
71
|
clientID="donate"
|
|
72
72
|
cartID="default-comicrelief"
|
|
@@ -91,7 +91,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
91
91
|
mobileImageLow={mobilePictures.imageLow}
|
|
92
92
|
mobileImages={mobilePictures.images}
|
|
93
93
|
data={data}
|
|
94
|
-
mbshipID="mship-
|
|
94
|
+
mbshipID="mship-4"
|
|
95
95
|
donateLink="https://donation.comicrelief.com/"
|
|
96
96
|
clientID="donate"
|
|
97
97
|
cartID="default-comicrelief"
|
|
@@ -118,7 +118,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
118
118
|
mobileImageLow={mobilePictures.imageLow}
|
|
119
119
|
mobileImages={mobilePictures.images}
|
|
120
120
|
data={data}
|
|
121
|
-
mbshipID="mship-
|
|
121
|
+
mbshipID="mship-5"
|
|
122
122
|
donateLink="https://donation.comicrelief.com/"
|
|
123
123
|
clientID="donate"
|
|
124
124
|
cartID="default-comicrelief"
|
|
@@ -143,7 +143,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
143
143
|
mobileImageLow={mobilePictures.imageLow}
|
|
144
144
|
mobileImages={mobilePictures.images}
|
|
145
145
|
data={data}
|
|
146
|
-
mbshipID="mship-
|
|
146
|
+
mbshipID="mship-6"
|
|
147
147
|
donateLink="https://donation.comicrelief.com/"
|
|
148
148
|
clientID="donate"
|
|
149
149
|
cartID="default-comicrelief"
|
|
@@ -168,7 +168,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
168
168
|
mobileImageLow={mobilePictures.imageLow}
|
|
169
169
|
mobileImages={mobilePictures.images}
|
|
170
170
|
data={data}
|
|
171
|
-
mbshipID="mship-
|
|
171
|
+
mbshipID="mship-7"
|
|
172
172
|
donateLink="https://donation.comicrelief.com/"
|
|
173
173
|
clientID="donate"
|
|
174
174
|
cartID="default-comicrelief"
|
|
@@ -193,7 +193,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
193
193
|
mobileImageLow={mobilePictures.imageLow}
|
|
194
194
|
mobileImages={mobilePictures.images}
|
|
195
195
|
data={data}
|
|
196
|
-
mbshipID="mship-
|
|
196
|
+
mbshipID="mship-8"
|
|
197
197
|
donateLink="https://donation.comicrelief.com/"
|
|
198
198
|
clientID="donate"
|
|
199
199
|
cartID="default-comicrelief"
|
|
@@ -213,7 +213,7 @@ import data from './dev-data/data-single';
|
|
|
213
213
|
backgroundColor="blue_dark"
|
|
214
214
|
formAlignRight={false}
|
|
215
215
|
data={data}
|
|
216
|
-
mbshipID="mship-
|
|
216
|
+
mbshipID="mship-9"
|
|
217
217
|
donateLink="https://donation.comicrelief.com/"
|
|
218
218
|
clientID="donate"
|
|
219
219
|
cartID="default-comicrelief"
|
|
@@ -241,7 +241,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
|
241
241
|
mobileImageLow={mobilePictures.imageLow}
|
|
242
242
|
mobileImages={mobilePictures.images}
|
|
243
243
|
data={data}
|
|
244
|
-
mbshipID="mship-
|
|
244
|
+
mbshipID="mship-10"
|
|
245
245
|
donateLink="https://donation.comicrelief.com/"
|
|
246
246
|
clientID="donate"
|
|
247
247
|
cartID="default-comicrelief"
|
|
@@ -125,6 +125,7 @@ const Signup = ({
|
|
|
125
125
|
givingType={givingType}
|
|
126
126
|
changeGivingType={data => setGivingType(data)}
|
|
127
127
|
setPopOpen={setPopOpen}
|
|
128
|
+
mbshipID={mbshipID}
|
|
128
129
|
/>
|
|
129
130
|
)}
|
|
130
131
|
|
|
@@ -178,7 +179,7 @@ const Signup = ({
|
|
|
178
179
|
id={`${mbshipID}--MoneyBuy-userInput`}
|
|
179
180
|
showLabel
|
|
180
181
|
{...rest}
|
|
181
|
-
max="
|
|
182
|
+
max="25000"
|
|
182
183
|
min="1"
|
|
183
184
|
value={amountDonate}
|
|
184
185
|
pattern="[^[0-9]+([,.][0-9]+)?$]"
|
|
@@ -193,6 +194,14 @@ const Signup = ({
|
|
|
193
194
|
{moneyBuyCopy}
|
|
194
195
|
</Copy>
|
|
195
196
|
)}
|
|
197
|
+
|
|
198
|
+
{errorMsg && (
|
|
199
|
+
<Error className="error--amount" tag="p">
|
|
200
|
+
Please enter an amount between £1 and £25000 and up to 2 decimal
|
|
201
|
+
places
|
|
202
|
+
</Error>
|
|
203
|
+
)}
|
|
204
|
+
|
|
196
205
|
{noMoneyBuys ? (
|
|
197
206
|
<Button type="submit" as="input" value="Donate" />
|
|
198
207
|
) : (
|
|
@@ -202,12 +211,7 @@ const Signup = ({
|
|
|
202
211
|
value={givingType === 'single' ? 'Donate now' : 'Donate monthly'}
|
|
203
212
|
/>
|
|
204
213
|
)}
|
|
205
|
-
|
|
206
|
-
<Error tag="p">
|
|
207
|
-
Please enter an amount between £1 and £20000 and up to 2 decimal
|
|
208
|
-
places
|
|
209
|
-
</Error>
|
|
210
|
-
)}
|
|
214
|
+
|
|
211
215
|
</OuterFieldset>
|
|
212
216
|
</Form>
|
|
213
217
|
</FormWrapper>
|
|
@@ -1,91 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import { media } from '../../../../theme/shared/size';
|
|
6
|
-
import spacing from '../../../../theme/shared/spacing';
|
|
7
|
-
import zIndex from '../../../../theme/shared/zIndex';
|
|
8
|
-
import hideVisually from '../../../../theme/shared/hideVisually';
|
|
9
|
-
|
|
10
|
-
const Switch = styled.span`
|
|
11
|
-
width: 50%;
|
|
12
|
-
height: 48px;
|
|
13
|
-
border-radius: 2rem;
|
|
14
|
-
${zIndex('low')};
|
|
15
|
-
display: block;
|
|
16
|
-
position: absolute;
|
|
17
|
-
transition: left 0.15s ease-out;
|
|
18
|
-
background-color: ${({ theme }) => theme.color('blue')};
|
|
19
|
-
left: 2px;
|
|
20
|
-
box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.3);
|
|
21
|
-
`;
|
|
22
2
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const MoneyBox = styled.div`
|
|
29
|
-
width: 100%;
|
|
30
|
-
padding: 2px;
|
|
31
|
-
position: relative;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: row;
|
|
34
|
-
margin: ${spacing('md')} 0;
|
|
35
|
-
border-radius: 2rem;
|
|
36
|
-
background: ${({ theme }) => theme.color('blue_light')};
|
|
37
|
-
${media('small')} {
|
|
38
|
-
width: 450px;
|
|
39
|
-
margin: 0 auto;
|
|
40
|
-
}
|
|
41
|
-
#give-monthly:checked ~ ${Switch} {
|
|
42
|
-
left: calc(50% - 2px);
|
|
43
|
-
}
|
|
44
|
-
input {
|
|
45
|
-
${hideVisually}
|
|
46
|
-
}
|
|
47
|
-
input:focus:not(:checked) + label {
|
|
48
|
-
box-shadow: inset 0 0 0 4px ${({ theme }) => theme.color('blue')};
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
const Label = styled.label`
|
|
53
|
-
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
54
|
-
font-family: ${({ theme }) => theme.fontFamilies('Montserrat')};
|
|
55
|
-
font-weight: bold;
|
|
56
|
-
min-height: 48px;
|
|
57
|
-
align-items: center;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-basis: 50%;
|
|
61
|
-
border: none;
|
|
62
|
-
transition: color 0.15s ease-out;
|
|
63
|
-
${zIndex('medium')};
|
|
64
|
-
cursor: ${({ active }) => (active === true ? 'default' : 'pointer')};
|
|
65
|
-
&:active:focus {
|
|
66
|
-
box-shadow: none;
|
|
67
|
-
}
|
|
68
|
-
&:focus {
|
|
69
|
-
border: none;
|
|
70
|
-
outline: none;
|
|
71
|
-
box-shadow: inset 0 0 0 4px ${({ theme }) => theme.color('blue')};
|
|
72
|
-
}
|
|
73
|
-
&[for='give-once'] {
|
|
74
|
-
border-radius: 2rem;
|
|
75
|
-
color: ${({ active, theme }) => (active === true ? theme.color('white') : theme.color('black'))};
|
|
76
|
-
}
|
|
77
|
-
&[for='give-monthly'] {
|
|
78
|
-
border-radius: 2rem;
|
|
79
|
-
color: ${({ active, theme }) => (active === true ? theme.color('white') : theme.color('black'))};
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import {
|
|
5
|
+
Switch, Wrapper, MoneyBox, Label
|
|
6
|
+
} from './GivingSelector.style';
|
|
82
7
|
|
|
83
|
-
const GivingSelector = ({
|
|
8
|
+
const GivingSelector = ({
|
|
9
|
+
givingType, changeGivingType, setPopOpen, mbshipID
|
|
10
|
+
}) => (
|
|
84
11
|
<Wrapper>
|
|
85
12
|
<MoneyBox>
|
|
86
13
|
<input
|
|
14
|
+
className="give-once"
|
|
87
15
|
aria-label="Single"
|
|
88
|
-
id=
|
|
16
|
+
id={`give-once--${mbshipID}`}
|
|
89
17
|
value="Single"
|
|
90
18
|
type="radio"
|
|
91
19
|
label=""
|
|
@@ -96,12 +24,13 @@ const GivingSelector = ({ givingType, changeGivingType, setPopOpen }) => (
|
|
|
96
24
|
setPopOpen(true);
|
|
97
25
|
}}
|
|
98
26
|
/>
|
|
99
|
-
<Label active={givingType === 'single'} htmlFor=
|
|
27
|
+
<Label active={givingType === 'single'} htmlFor={`give-once--${mbshipID}`}>
|
|
100
28
|
Single
|
|
101
29
|
</Label>
|
|
102
30
|
<input
|
|
31
|
+
className="give-monthly"
|
|
103
32
|
aria-label="Monthly"
|
|
104
|
-
id=
|
|
33
|
+
id={`give-monthly--${mbshipID}`}
|
|
105
34
|
value="Monthly"
|
|
106
35
|
type="radio"
|
|
107
36
|
label=""
|
|
@@ -112,7 +41,7 @@ const GivingSelector = ({ givingType, changeGivingType, setPopOpen }) => (
|
|
|
112
41
|
setPopOpen(false);
|
|
113
42
|
}}
|
|
114
43
|
/>
|
|
115
|
-
<Label active={givingType === 'monthly'} htmlFor=
|
|
44
|
+
<Label active={givingType === 'monthly'} htmlFor={`give-monthly--${mbshipID}`}>
|
|
116
45
|
Monthly
|
|
117
46
|
</Label>
|
|
118
47
|
<Switch />
|
|
@@ -123,7 +52,8 @@ const GivingSelector = ({ givingType, changeGivingType, setPopOpen }) => (
|
|
|
123
52
|
GivingSelector.propTypes = {
|
|
124
53
|
givingType: PropTypes.string.isRequired,
|
|
125
54
|
changeGivingType: PropTypes.func.isRequired,
|
|
126
|
-
setPopOpen: PropTypes.func.isRequired
|
|
55
|
+
setPopOpen: PropTypes.func.isRequired,
|
|
56
|
+
mbshipID: PropTypes.string.isRequired
|
|
127
57
|
};
|
|
128
58
|
|
|
129
59
|
export default GivingSelector;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { media } from '../../../../theme/shared/size';
|
|
4
|
+
import spacing from '../../../../theme/shared/spacing';
|
|
5
|
+
import zIndex from '../../../../theme/shared/zIndex';
|
|
6
|
+
import hideVisually from '../../../../theme/shared/hideVisually';
|
|
7
|
+
|
|
8
|
+
const Switch = styled.span`
|
|
9
|
+
width: 50%;
|
|
10
|
+
height: 48px;
|
|
11
|
+
border-radius: 2rem;
|
|
12
|
+
${zIndex('low')};
|
|
13
|
+
display: block;
|
|
14
|
+
position: absolute;
|
|
15
|
+
transition: left 0.15s ease-out;
|
|
16
|
+
background-color: ${({ theme }) => theme.color('blue')};
|
|
17
|
+
left: 2px;
|
|
18
|
+
box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.3);
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const Wrapper = styled.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
margin: ${spacing('md')} 0;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const MoneyBox = styled.div`
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: 2px;
|
|
29
|
+
position: relative;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
margin: ${spacing('md')} 0;
|
|
33
|
+
border-radius: 2rem;
|
|
34
|
+
background: ${({ theme }) => theme.color('blue_light')};
|
|
35
|
+
${media('small')} {
|
|
36
|
+
width: 450px;
|
|
37
|
+
margin: 0 auto;
|
|
38
|
+
}
|
|
39
|
+
.give-monthly:checked ~ ${Switch} {
|
|
40
|
+
left: calc(50% - 2px);
|
|
41
|
+
}
|
|
42
|
+
input {
|
|
43
|
+
${hideVisually}
|
|
44
|
+
}
|
|
45
|
+
input:focus:not(:checked) + label {
|
|
46
|
+
box-shadow: inset 0 0 0 4px ${({ theme }) => theme.color('blue')};
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const Label = styled.label`
|
|
51
|
+
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
52
|
+
font-family: ${({ theme }) => theme.fontFamilies('Montserrat')};
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
min-height: 48px;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-basis: 50%;
|
|
59
|
+
border: none;
|
|
60
|
+
transition: color 0.15s ease-out;
|
|
61
|
+
${zIndex('medium')};
|
|
62
|
+
cursor: ${({ active }) => (active === true ? 'default' : 'pointer')};
|
|
63
|
+
border-radius: 2rem;
|
|
64
|
+
color: ${({ active, theme }) => (active === true ? theme.color('white') : theme.color('black'))};
|
|
65
|
+
|
|
66
|
+
&:active:focus {
|
|
67
|
+
box-shadow: none;
|
|
68
|
+
}
|
|
69
|
+
&:focus {
|
|
70
|
+
border: none;
|
|
71
|
+
outline: none;
|
|
72
|
+
box-shadow: inset 0 0 0 4px ${({ theme }) => theme.color('blue')};
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
Switch, Wrapper, MoneyBox, Label
|
|
78
|
+
};
|