@comicrelief/component-library 8.55.0 → 8.55.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/dist/components/Molecules/HeroBanner/HeroBanner.style.js +68 -62
- package/dist/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +7 -4
- package/dist/components/Organisms/DonateBanner/DonateBanner.js +12 -10
- package/dist/components/Organisms/DonateBanner/DonateBanner.md +24 -2
- package/dist/components/Organisms/DonateBanner/DonateBanner.style.js +34 -39
- package/dist/components/Organisms/DonateBanner/Form/Form.js +21 -26
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +1 -3
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +43 -7
- package/dist/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +20 -10
- package/dist/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +355 -316
- package/dist/theme/shared/animations.js +9 -0
- package/package.json +1 -1
- package/src/components/Molecules/HeroBanner/HeroBanner.style.js +4 -3
- package/src/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +7 -4
- package/src/components/Organisms/DonateBanner/DonateBanner.js +15 -11
- package/src/components/Organisms/DonateBanner/DonateBanner.md +24 -2
- package/src/components/Organisms/DonateBanner/DonateBanner.style.js +12 -12
- package/src/components/Organisms/DonateBanner/Form/Form.js +41 -32
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +2 -4
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +20 -3
- package/src/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +9 -1
- package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +355 -316
- package/src/theme/shared/animations.js +24 -1
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _PopUpComponent = _interopRequireDefault(require("./PopUpComponent"));
|
|
11
10
|
var _MoneyBuy = _interopRequireDefault(require("../MoneyBuy/MoneyBuy"));
|
|
12
11
|
var _Membership = require("../../../../utils/Membership");
|
|
13
12
|
var _DonateBanner = require("../DonateBanner.style");
|
|
@@ -25,22 +24,22 @@ const Signup = _ref => {
|
|
|
25
24
|
mbshipID,
|
|
26
25
|
donateOrientation = 'right',
|
|
27
26
|
noMoneyBuys = false,
|
|
28
|
-
popUpText,
|
|
29
|
-
chooseAmountText = null,
|
|
30
|
-
monthlyChooseAmountText = null,
|
|
31
27
|
submitButtonColor = 'red',
|
|
32
28
|
changeGivingType,
|
|
33
29
|
givingType = null,
|
|
34
30
|
hasTopImage = false,
|
|
35
31
|
shouldShowTitleSection = false,
|
|
32
|
+
donateWidgetIsTextOnly = false,
|
|
33
|
+
thisTitle = null,
|
|
34
|
+
thisSubtitle = null,
|
|
35
|
+
showCopy = false,
|
|
36
|
+
isLargeBreakpoint = false,
|
|
37
|
+
isMediumBreakpoint = false,
|
|
36
38
|
...rest
|
|
37
39
|
} = _ref;
|
|
38
40
|
const [errorMsg, setErrorMsg] = (0, _react.useState)(false);
|
|
39
41
|
const [amountDonate, setAmountDonate] = (0, _react.useState)(10);
|
|
40
42
|
const [moneyBuyCopy, setMoneyBuyCopy] = (0, _react.useState)(true);
|
|
41
|
-
const [popOpen, setPopOpen] = (0, _react.useState)(false);
|
|
42
|
-
// In order to keep track of whether the user has ever been shown the popup
|
|
43
|
-
const [popUpShown, setPopUpShown] = (0, _react.useState)(false);
|
|
44
43
|
(0, _react.useEffect)(() => {
|
|
45
44
|
if (givingType) {
|
|
46
45
|
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
@@ -75,12 +74,6 @@ const Signup = _ref => {
|
|
|
75
74
|
}
|
|
76
75
|
}, [errorMsg, moneyBuyCopy, singleGiving, regularGiving, givingType, amountDonate, otherAmountText, noMoneyBuys]);
|
|
77
76
|
|
|
78
|
-
// Updates our flag that differentiates between the popup
|
|
79
|
-
// being *currently* open and it *ever* having been shown to user
|
|
80
|
-
(0, _react.useEffect)(() => {
|
|
81
|
-
if (popOpen && !popUpShown) setPopUpShown(true);
|
|
82
|
-
}, [popOpen, popUpShown]);
|
|
83
|
-
|
|
84
77
|
// On load, determine what should actually be the default giving type
|
|
85
78
|
(0, _react.useEffect)(() => {
|
|
86
79
|
const newGivingType = singleGiving !== null ? 'single' : 'monthly';
|
|
@@ -90,7 +83,7 @@ const Signup = _ref => {
|
|
|
90
83
|
const submitDonation = (event, amount, clientId, cartId, mbshipId, donateURL) => {
|
|
91
84
|
event.preventDefault();
|
|
92
85
|
if ((0, _Membership.isAmountValid)(amount) && !errorMsg) {
|
|
93
|
-
(0, _Membership.handleDonateSubmission)(amount, clientId, cartId, mbshipId, donateURL, givingType,
|
|
86
|
+
(0, _Membership.handleDonateSubmission)(amount, clientId, cartId, mbshipId, donateURL, givingType, null);
|
|
94
87
|
} else {
|
|
95
88
|
setErrorMsg(true);
|
|
96
89
|
setMoneyBuyCopy(false);
|
|
@@ -141,26 +134,28 @@ const Signup = _ref => {
|
|
|
141
134
|
}
|
|
142
135
|
return `Donate £${amountDonate} monthly`;
|
|
143
136
|
};
|
|
144
|
-
const
|
|
145
|
-
|
|
137
|
+
const shouldShowTitleInForm = showCopy && (!donateWidgetIsTextOnly || donateWidgetIsTextOnly && !isLargeBreakpoint);
|
|
138
|
+
|
|
139
|
+
// Use h1 tag for text-only version, p tag for image version
|
|
140
|
+
const titleTag = donateWidgetIsTextOnly ? 'h1' : 'p';
|
|
146
141
|
return /*#__PURE__*/_react.default.createElement(_DonateBanner.FormWrapper, {
|
|
147
142
|
donateOrientation: donateOrientation,
|
|
148
143
|
shouldShowTitleSection: shouldShowTitleSection
|
|
149
|
-
},
|
|
150
|
-
popUpText: popUpText,
|
|
151
|
-
setPopOpen: setPopOpen
|
|
152
|
-
}), /*#__PURE__*/_react.default.createElement(_DonateBanner.Form, {
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement(_DonateBanner.Form, {
|
|
153
145
|
donateOrientation: donateOrientation,
|
|
154
146
|
hasTopImage: hasTopImage,
|
|
155
147
|
shouldShowTitleSection: shouldShowTitleSection,
|
|
156
148
|
onSubmit: e => submitDonation(e, amountDonate, clientID, cartID, mbshipID, donateLink)
|
|
157
|
-
}, /*#__PURE__*/_react.default.createElement(_DonateBanner.OuterFieldset, null, /*#__PURE__*/_react.default.createElement(_DonateBanner.Legend, null, /*#__PURE__*/_react.default.createElement(_DonateBanner.PrimaryTitleText, {
|
|
158
|
-
tag:
|
|
159
|
-
|
|
160
|
-
},
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement(_DonateBanner.OuterFieldset, null, shouldShowTitleInForm ? /*#__PURE__*/_react.default.createElement(_DonateBanner.Legend, null, /*#__PURE__*/_react.default.createElement(_DonateBanner.PrimaryTitleText, {
|
|
150
|
+
tag: titleTag,
|
|
151
|
+
$donateWidgetIsTextOnly: donateWidgetIsTextOnly
|
|
152
|
+
}, thisTitle), thisSubtitle && /*#__PURE__*/_react.default.createElement(_DonateBanner.SecondaryTitleText, {
|
|
153
|
+
tag: "p",
|
|
154
|
+
$showGivingSelector: showGivingSelector,
|
|
155
|
+
$isMediumBreakpoint: isMediumBreakpoint
|
|
156
|
+
}, thisSubtitle)) : null, showGivingSelector && /*#__PURE__*/_react.default.createElement(_GivingSelector.default, {
|
|
161
157
|
givingType: givingType,
|
|
162
158
|
changeGivingType: data => changeGivingType(data),
|
|
163
|
-
setPopOpen: setPopOpen,
|
|
164
159
|
mbshipID: mbshipID
|
|
165
160
|
}), !noMoneyBuys && givingType && /*#__PURE__*/_react.default.createElement(_DonateBanner.MoneyBuys, null, givingData.moneybuys.map((_ref2, index) => {
|
|
166
161
|
let {
|
|
@@ -199,7 +194,7 @@ const Signup = _ref => {
|
|
|
199
194
|
placeholder: "0.00",
|
|
200
195
|
onChange: e => setAmountDonate(e.target.value.trim()),
|
|
201
196
|
ref: amountRef
|
|
202
|
-
}))), amountDonate >= 1 && moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_DonateBanner.
|
|
197
|
+
}))), amountDonate >= 1 && moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_DonateBanner.MoneybuyCopy, null, /*#__PURE__*/_react.default.createElement("strong", null, `£${amountDonate} `), moneyBuyCopy), errorMsg && /*#__PURE__*/_react.default.createElement(_DonateBanner.Error, {
|
|
203
198
|
className: "error--amount",
|
|
204
199
|
tag: "p"
|
|
205
200
|
}, "Please enter an amount between \xA31 and \xA325000 and up to 2 decimal places"), /*#__PURE__*/_react.default.createElement(_DonateBanner.Button, {
|
|
@@ -11,14 +11,12 @@ const GivingSelector = _ref => {
|
|
|
11
11
|
let {
|
|
12
12
|
givingType = null,
|
|
13
13
|
changeGivingType,
|
|
14
|
-
setPopOpen,
|
|
15
14
|
mbshipID
|
|
16
15
|
} = _ref;
|
|
17
|
-
// Only updates giving type
|
|
16
|
+
// Only updates giving type when appropriate
|
|
18
17
|
const handleGivingTypeChange = (thisButtonType, currentGivingType) => {
|
|
19
18
|
if (currentGivingType !== thisButtonType) {
|
|
20
19
|
changeGivingType(thisButtonType);
|
|
21
|
-
setPopOpen(thisButtonType === 'single');
|
|
22
20
|
}
|
|
23
21
|
};
|
|
24
22
|
return /*#__PURE__*/_react.default.createElement(_GivingSelector.Wrapper, null, /*#__PURE__*/_react.default.createElement(_GivingSelector.MoneyBox, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
@@ -25,26 +25,26 @@ const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
|
|
|
25
25
|
const MoneyBox = exports.MoneyBox = _styledComponents.default.div.withConfig({
|
|
26
26
|
displayName: "GivingSelectorstyle__MoneyBox",
|
|
27
27
|
componentId: "sc-bcwmru-2"
|
|
28
|
-
})(["width:100%;position:relative;display:flex;flex-direction:row;margin:", " 0;overflow:hidden;border-radius:0.5rem;
|
|
28
|
+
})(["width:100%;position:relative;display:flex;flex-direction:row;margin:", " 0;overflow:hidden;border-radius:0.5rem;background:", ";@media ", "{margin:0 auto;}.give-monthly:checked ~ ", "{left:calc(50%);}input{", "}input:focus-visible + label{", ";box-shadow:inset 0 0 0 2px ", "};}"], (0, _spacing.default)('sm'), _ref2 => {
|
|
29
29
|
let {
|
|
30
30
|
theme
|
|
31
31
|
} = _ref2;
|
|
32
|
-
return theme.color('
|
|
32
|
+
return theme.color('white');
|
|
33
33
|
}, _ref3 => {
|
|
34
34
|
let {
|
|
35
35
|
theme
|
|
36
36
|
} = _ref3;
|
|
37
|
-
return theme.
|
|
38
|
-
}, _ref4 => {
|
|
37
|
+
return theme.allBreakpoints('M');
|
|
38
|
+
}, Switch, _hideVisually.default, (0, _zIndex.default)('high'), _ref4 => {
|
|
39
39
|
let {
|
|
40
40
|
theme
|
|
41
41
|
} = _ref4;
|
|
42
|
-
return theme.
|
|
43
|
-
}
|
|
42
|
+
return theme.color('blue_donate');
|
|
43
|
+
});
|
|
44
44
|
const Label = exports.Label = _styledComponents.default.label.withConfig({
|
|
45
45
|
displayName: "GivingSelectorstyle__Label",
|
|
46
46
|
componentId: "sc-bcwmru-3"
|
|
47
|
-
})(["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:
|
|
47
|
+
})(["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:", ";color:", ";&:first-of-type{border-left:1px solid ", ";border-top:1px solid ", ";border-bottom:1px solid ", ";border-radius:0.5rem 0 0 0.5rem;}&:last-of-type{border-right:1px solid ", ";border-top:1px solid ", ";border-bottom:1px solid ", ";border-radius:0 0.5rem 0.5rem 0;}&:active:focus{box-shadow:none;}&:focus{border:none;box-shadow:inset 0 0 0 4px ", ";}"], _ref5 => {
|
|
48
48
|
let {
|
|
49
49
|
theme
|
|
50
50
|
} = _ref5;
|
|
@@ -67,7 +67,43 @@ const Label = exports.Label = _styledComponents.default.label.withConfig({
|
|
|
67
67
|
return active === true ? theme.color('white') : theme.color('black');
|
|
68
68
|
}, _ref9 => {
|
|
69
69
|
let {
|
|
70
|
+
active,
|
|
70
71
|
theme
|
|
71
72
|
} = _ref9;
|
|
73
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
74
|
+
}, _ref10 => {
|
|
75
|
+
let {
|
|
76
|
+
active,
|
|
77
|
+
theme
|
|
78
|
+
} = _ref10;
|
|
79
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
80
|
+
}, _ref11 => {
|
|
81
|
+
let {
|
|
82
|
+
active,
|
|
83
|
+
theme
|
|
84
|
+
} = _ref11;
|
|
85
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
86
|
+
}, _ref12 => {
|
|
87
|
+
let {
|
|
88
|
+
active,
|
|
89
|
+
theme
|
|
90
|
+
} = _ref12;
|
|
91
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
92
|
+
}, _ref13 => {
|
|
93
|
+
let {
|
|
94
|
+
active,
|
|
95
|
+
theme
|
|
96
|
+
} = _ref13;
|
|
97
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
98
|
+
}, _ref14 => {
|
|
99
|
+
let {
|
|
100
|
+
active,
|
|
101
|
+
theme
|
|
102
|
+
} = _ref14;
|
|
103
|
+
return active ? theme.color('red') : theme.color('grey');
|
|
104
|
+
}, _ref15 => {
|
|
105
|
+
let {
|
|
106
|
+
theme
|
|
107
|
+
} = _ref15;
|
|
72
108
|
return theme.color('red');
|
|
73
109
|
});
|
|
@@ -12,7 +12,7 @@ var _Input = _interopRequireDefault(require("../../../Atoms/Input/Input"));
|
|
|
12
12
|
const MoneyBuyButton = (0, _styledComponents.default)(_Input.default).withConfig({
|
|
13
13
|
displayName: "MoneyBuy__MoneyBuyButton",
|
|
14
14
|
componentId: "sc-1ggxiga-0"
|
|
15
|
-
})(["display:block;input{border:none;background-color:", ";color:", ";font-size:", ";font-family:", ";font-weight:normal;border-radius:0.5rem;height:
|
|
15
|
+
})(["display:block;input{border:none;background-color:", ";color:", ";font-size:", ";font-family:", ";font-weight:normal;border-radius:0.5rem;height:3.75rem;border:1px solid ", ";&:focus{border:1px solid ", ";}@media ", "{height:4.5rem;}@media ", "{height:3.4375rem;}", "}"], _ref => {
|
|
16
16
|
let {
|
|
17
17
|
theme
|
|
18
18
|
} = _ref;
|
|
@@ -44,33 +44,43 @@ const MoneyBuyButton = (0, _styledComponents.default)(_Input.default).withConfig
|
|
|
44
44
|
return theme.color('red');
|
|
45
45
|
}, _ref7 => {
|
|
46
46
|
let {
|
|
47
|
-
|
|
47
|
+
theme
|
|
48
48
|
} = _ref7;
|
|
49
|
-
return
|
|
49
|
+
return theme.allBreakpoints('M');
|
|
50
|
+
}, _ref8 => {
|
|
51
|
+
let {
|
|
52
|
+
theme
|
|
53
|
+
} = _ref8;
|
|
54
|
+
return theme.allBreakpoints('L');
|
|
55
|
+
}, _ref9 => {
|
|
56
|
+
let {
|
|
57
|
+
isSelected
|
|
58
|
+
} = _ref9;
|
|
59
|
+
return isSelected && (0, _styledComponents.css)(["background-color:", ";border:1px solid ", ";color:", ";"], _ref10 => {
|
|
50
60
|
let {
|
|
51
61
|
theme
|
|
52
|
-
} =
|
|
62
|
+
} = _ref10;
|
|
53
63
|
return theme.color('red');
|
|
54
|
-
},
|
|
64
|
+
}, _ref11 => {
|
|
55
65
|
let {
|
|
56
66
|
theme
|
|
57
|
-
} =
|
|
67
|
+
} = _ref11;
|
|
58
68
|
return theme.color('red');
|
|
59
|
-
},
|
|
69
|
+
}, _ref12 => {
|
|
60
70
|
let {
|
|
61
71
|
theme
|
|
62
|
-
} =
|
|
72
|
+
} = _ref12;
|
|
63
73
|
return theme.color('white');
|
|
64
74
|
});
|
|
65
75
|
});
|
|
66
|
-
const MoneyBuy =
|
|
76
|
+
const MoneyBuy = _ref13 => {
|
|
67
77
|
let {
|
|
68
78
|
setOtherAmount,
|
|
69
79
|
amount = '10',
|
|
70
80
|
currency = '£',
|
|
71
81
|
description = 'description',
|
|
72
82
|
...rest
|
|
73
|
-
} =
|
|
83
|
+
} = _ref13;
|
|
74
84
|
return /*#__PURE__*/_react.default.createElement(MoneyBuyButton, Object.assign({}, rest, {
|
|
75
85
|
label: description,
|
|
76
86
|
showLabel: false,
|