@comicrelief/component-library 8.55.1 → 8.55.3
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/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/global.css +2 -2
- package/package.json +1 -1
- 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/global.css +2 -2
|
@@ -26,7 +26,6 @@ const DonateBanner = _ref => {
|
|
|
26
26
|
subtitle = '',
|
|
27
27
|
monthlyTitle = '',
|
|
28
28
|
monthlySubtitle = '',
|
|
29
|
-
popUpText = 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
|
|
30
29
|
chooseAmountText = null,
|
|
31
30
|
monthlyChooseAmountText = null,
|
|
32
31
|
otherAmountText = 'will help us fund amazing projects in the UK and around the world.',
|
|
@@ -41,7 +40,7 @@ const DonateBanner = _ref => {
|
|
|
41
40
|
donateLink,
|
|
42
41
|
mbshipID
|
|
43
42
|
} = _ref;
|
|
44
|
-
const
|
|
43
|
+
const isLargeBreakpoint = (0, _reactResponsive.useMediaQuery)({
|
|
45
44
|
query: `(min-width: ${_allBreakpoints.breakpointValues.L}px)`
|
|
46
45
|
});
|
|
47
46
|
const isMedium = (0, _reactResponsive.useMediaQuery)({
|
|
@@ -58,14 +57,14 @@ const DonateBanner = _ref => {
|
|
|
58
57
|
thisOtherAmountText
|
|
59
58
|
} = (0, _utils.handleOtherAmountText)(givingType, otherAmountText, monthlyOtherAmountText);
|
|
60
59
|
const shouldShowImage = donateWidgetIsTextOnly === false;
|
|
61
|
-
const shouldShowDesktopImage = shouldShowImage &&
|
|
62
|
-
const shouldShowTopImage = shouldShowImage && !
|
|
60
|
+
const shouldShowDesktopImage = shouldShowImage && isLargeBreakpoint && imageL && (imageL.images || imageL.image);
|
|
61
|
+
const shouldShowTopImage = shouldShowImage && !isLargeBreakpoint;
|
|
63
62
|
const topImage = isMedium ? imageM : imageS;
|
|
64
|
-
const shouldRenderTopImage = shouldShowTopImage && topImage && (topImage.images || topImage.image);
|
|
63
|
+
const shouldRenderTopImage = !!(shouldShowTopImage && topImage && (topImage.images || topImage.image));
|
|
65
64
|
|
|
66
65
|
// For text-only variants, we hide the title area on non-desktop widths
|
|
67
66
|
// (M and below), so only the form is shown.
|
|
68
|
-
const shouldShowTitleSection = noTitlesAtAll === false &&
|
|
67
|
+
const shouldShowTitleSection = noTitlesAtAll === false && isLargeBreakpoint && donateWidgetIsTextOnly;
|
|
69
68
|
return /*#__PURE__*/_react.default.createElement(_DonateBanner.Container, {
|
|
70
69
|
paddingAbove: paddingAbove,
|
|
71
70
|
paddingBelow: paddingBelow,
|
|
@@ -103,8 +102,7 @@ const DonateBanner = _ref => {
|
|
|
103
102
|
}, shouldShowTitleSection && /*#__PURE__*/_react.default.createElement(_DonateBanner.TitleWrapperOuter, {
|
|
104
103
|
donateOrientation: donateOrientation
|
|
105
104
|
}, /*#__PURE__*/_react.default.createElement(_DonateBanner.TitleWrapperInner, null, showCopy && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
106
|
-
tag: "
|
|
107
|
-
size: "big",
|
|
105
|
+
tag: "h1",
|
|
108
106
|
family: "Anton",
|
|
109
107
|
weight: "normal"
|
|
110
108
|
}, thisTitle), /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
@@ -118,7 +116,6 @@ const DonateBanner = _ref => {
|
|
|
118
116
|
mbshipID: mbshipID,
|
|
119
117
|
donateLink: donateLink,
|
|
120
118
|
hideMoneyBuys: hideMoneyBuys,
|
|
121
|
-
popUpText: popUpText,
|
|
122
119
|
chooseAmountText: chooseAmountText,
|
|
123
120
|
monthlyChooseAmountText: monthlyChooseAmountText,
|
|
124
121
|
donateWidgetIsTextOnly: donateWidgetIsTextOnly,
|
|
@@ -126,7 +123,12 @@ const DonateBanner = _ref => {
|
|
|
126
123
|
shouldShowTitleSection: shouldShowTitleSection,
|
|
127
124
|
donateOrientation: donateOrientation,
|
|
128
125
|
givingType: givingType,
|
|
129
|
-
changeGivingType: setGivingType
|
|
126
|
+
changeGivingType: setGivingType,
|
|
127
|
+
thisTitle: thisTitle,
|
|
128
|
+
thisSubtitle: thisSubtitle,
|
|
129
|
+
showCopy: showCopy,
|
|
130
|
+
isLargeBreakpoint: isLargeBreakpoint,
|
|
131
|
+
isMediumBreakpoint: isMedium
|
|
130
132
|
}))));
|
|
131
133
|
};
|
|
132
134
|
var _default = exports.default = DonateBanner;
|
|
@@ -87,7 +87,6 @@ const imageS = {
|
|
|
87
87
|
monthlySubtitle="A regular gift helps fund long-term impact."
|
|
88
88
|
chooseAmountText="Choose a one-off amount"
|
|
89
89
|
monthlyChooseAmountText="Choose a monthly amount"
|
|
90
|
-
popUpText="Switching to a single gift means less predictable funding."
|
|
91
90
|
/>;
|
|
92
91
|
```
|
|
93
92
|
|
|
@@ -137,7 +136,30 @@ import data from './dev-data/data';
|
|
|
137
136
|
/>;
|
|
138
137
|
```
|
|
139
138
|
|
|
140
|
-
##
|
|
139
|
+
## Text-only widget (no image), with giving selector (single vs monthly)
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
import data from './dev-data/data';
|
|
143
|
+
|
|
144
|
+
<DonateBanner
|
|
145
|
+
donateWidgetIsTextOnly
|
|
146
|
+
pageBackgroundColour="grey_light"
|
|
147
|
+
paddingAbove="2rem"
|
|
148
|
+
paddingBelow="2rem"
|
|
149
|
+
donateOrientation="right"
|
|
150
|
+
data={data}
|
|
151
|
+
mbshipID="mbship-3c"
|
|
152
|
+
donateLink="https://donation.comicrelief.com/"
|
|
153
|
+
clientID="donate"
|
|
154
|
+
cartID="default-comicrelief"
|
|
155
|
+
title="Donate now"
|
|
156
|
+
subtitle="Choose between a one-off or monthly gift."
|
|
157
|
+
monthlyTitle="Give monthly"
|
|
158
|
+
monthlySubtitle="A regular gift helps fund long-term impact."
|
|
159
|
+
/>;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Different "Other amount" copy for single vs monthly
|
|
141
163
|
|
|
142
164
|
```js
|
|
143
165
|
import data from './dev-data/data';
|
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.Wrapper = exports.TitleWrapperOuter = exports.TitleWrapperInner = exports.SecondaryTitleText = exports.PrimaryTitleText = exports.OuterFieldset = exports.MoneyBuys = exports.Legend = exports.Label = exports.InnerContainer = exports.FormWrapper = exports.FormFieldset = exports.Form = exports.Error = exports.
|
|
8
|
+
exports.Wrapper = exports.TitleWrapperOuter = exports.TitleWrapperInner = exports.SecondaryTitleText = exports.PrimaryTitleText = exports.OuterFieldset = exports.MoneybuyCopy = exports.MoneyBuys = exports.Legend = exports.Label = exports.InnerContainer = exports.FormWrapper = exports.FormFieldset = exports.Form = exports.Error = exports.Container = exports.Button = exports.BgImage = exports.AmountField = void 0;
|
|
9
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
10
|
var _Input = _interopRequireDefault(require("../../Atoms/Input/Input"));
|
|
11
11
|
var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
|
|
@@ -31,7 +31,7 @@ const Container = exports.Container = _styledComponents.default.div.withConfig({
|
|
|
31
31
|
const InnerContainer = exports.InnerContainer = _styledComponents.default.div.withConfig({
|
|
32
32
|
displayName: "DonateBannerstyle__InnerContainer",
|
|
33
33
|
componentId: "sc-a4o3ek-1"
|
|
34
|
-
})(["position:relative;background-color:", ";border-radius:1rem;overflow:hidden;padding:none;width:100%;box-sizing:border-box;@media ", "{padding:", ";", "}@media ", "{padding-left:", ";padding-right:", ";}max-width:1500px;"], _ref3 => {
|
|
34
|
+
})(["position:relative;background-color:", ";border-radius:1rem;overflow:hidden;padding:none;width:100%;box-sizing:border-box;box-shadow:0px 0px 16px rgba(0,0,0,0.15);@media ", "{padding:", ";", "}@media ", "{padding-left:", ";padding-right:", ";}max-width:1500px;"], _ref3 => {
|
|
35
35
|
let {
|
|
36
36
|
theme,
|
|
37
37
|
componentBackgroundColour
|
|
@@ -141,7 +141,7 @@ const Error = exports.Error = (0, _styledComponents.default)(_Text.default).with
|
|
|
141
141
|
const Form = exports.Form = _styledComponents.default.form.withConfig({
|
|
142
142
|
displayName: "DonateBannerstyle__Form",
|
|
143
143
|
componentId: "sc-a4o3ek-8"
|
|
144
|
-
})(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);margin-left:auto;margin-right:auto;", " h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}@media ", "{width:100%;margin-right:auto;margin-left:auto;}@media ", "{margin-top:", ";border-radius:
|
|
144
|
+
})(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);margin-left:auto;margin-right:auto;", " h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}@media ", "{width:100%;margin-right:auto;margin-left:auto;}@media ", "{margin-top:", ";border-radius:1rem;max-width:461px;min-width:400px;margin-left:0;margin-right:0;}"], _ref19 => {
|
|
145
145
|
let {
|
|
146
146
|
theme
|
|
147
147
|
} = _ref19;
|
|
@@ -166,12 +166,12 @@ const Form = exports.Form = _styledComponents.default.form.withConfig({
|
|
|
166
166
|
const OuterFieldset = exports.OuterFieldset = _styledComponents.default.fieldset.withConfig({
|
|
167
167
|
displayName: "DonateBannerstyle__OuterFieldset",
|
|
168
168
|
componentId: "sc-a4o3ek-9"
|
|
169
|
-
})(["color:", ";padding:
|
|
169
|
+
})(["color:", ";padding:", ";margin:0;border:none;@media ", "{padding:0 ", " ", ";}input[type='submit']{margin-bottom:0;}"], _ref23 => {
|
|
170
170
|
let {
|
|
171
171
|
theme
|
|
172
172
|
} = _ref23;
|
|
173
173
|
return theme.color('black');
|
|
174
|
-
}, (0, _spacing.default)('
|
|
174
|
+
}, (0, _spacing.default)('m'), _ref24 => {
|
|
175
175
|
let {
|
|
176
176
|
theme
|
|
177
177
|
} = _ref24;
|
|
@@ -184,33 +184,28 @@ const Legend = exports.Legend = _styledComponents.default.legend.withConfig({
|
|
|
184
184
|
const PrimaryTitleText = exports.PrimaryTitleText = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
185
185
|
displayName: "DonateBannerstyle__PrimaryTitleText",
|
|
186
186
|
componentId: "sc-a4o3ek-11"
|
|
187
|
-
})(["display:block;text-align:left;font-
|
|
188
|
-
let {
|
|
189
|
-
theme
|
|
190
|
-
} = _ref25;
|
|
191
|
-
return theme.fontSize('s');
|
|
192
|
-
});
|
|
187
|
+
})(["display:block;text-align:left;font-weight:700;"]);
|
|
193
188
|
const SecondaryTitleText = exports.SecondaryTitleText = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
194
189
|
displayName: "DonateBannerstyle__SecondaryTitleText",
|
|
195
190
|
componentId: "sc-a4o3ek-12"
|
|
196
|
-
})(["display:block;text-align:left;font-size:", ";line-height:1.5;margin
|
|
191
|
+
})(["display:block;text-align:left;font-size:", ";line-height:1.5;margin:", " 0 !important;"], _ref25 => {
|
|
197
192
|
let {
|
|
198
193
|
theme
|
|
199
|
-
} =
|
|
194
|
+
} = _ref25;
|
|
200
195
|
return theme.fontSize('s');
|
|
201
196
|
}, (0, _spacing.default)('sm'));
|
|
202
197
|
const MoneyBuys = exports.MoneyBuys = _styledComponents.default.div.withConfig({
|
|
203
198
|
displayName: "DonateBannerstyle__MoneyBuys",
|
|
204
199
|
componentId: "sc-a4o3ek-13"
|
|
205
|
-
})(["display:flex;justify-content:space-between;flex-direction:column;margin-bottom:", ";@media ", "{flex-direction:row;margin-top:", ";}label{flex:0 0 31%;margin-bottom:", ";@media ", "{margin-bottom:0;}input{cursor:pointer;padding:", " ", ";}}"], (0, _spacing.default)('md'),
|
|
200
|
+
})(["display:flex;justify-content:space-between;flex-direction:column;margin-bottom:", ";@media ", "{flex-direction:row;margin-top:", ";}label{flex:0 0 31%;margin-bottom:", ";@media ", "{margin-bottom:0;}input{cursor:pointer;padding:", " ", ";}}"], (0, _spacing.default)('md'), _ref26 => {
|
|
206
201
|
let {
|
|
207
202
|
theme
|
|
208
|
-
} =
|
|
203
|
+
} = _ref26;
|
|
209
204
|
return theme.allBreakpoints('M');
|
|
210
|
-
}, (0, _spacing.default)('m'), (0, _spacing.default)('sm'),
|
|
205
|
+
}, (0, _spacing.default)('m'), (0, _spacing.default)('sm'), _ref27 => {
|
|
211
206
|
let {
|
|
212
207
|
theme
|
|
213
|
-
} =
|
|
208
|
+
} = _ref27;
|
|
214
209
|
return theme.allBreakpoints('M');
|
|
215
210
|
}, (0, _spacing.default)('sm'), (0, _spacing.default)('m'));
|
|
216
211
|
const FormFieldset = exports.FormFieldset = _styledComponents.default.div.withConfig({
|
|
@@ -224,45 +219,50 @@ const Label = exports.Label = (0, _styledComponents.default)(_Text.default).with
|
|
|
224
219
|
const AmountField = exports.AmountField = (0, _styledComponents.default)(_Input.default).withConfig({
|
|
225
220
|
displayName: "DonateBannerstyle__AmountField",
|
|
226
221
|
componentId: "sc-a4o3ek-16"
|
|
227
|
-
})(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", " @media ", "{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:1px solid ", ";background:", ";border-radius:0.5rem;padding:", " ", " ", " ", ";&:focus{outline:none;border:1px solid ", ";}}"],
|
|
222
|
+
})(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", " @media ", "{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:1px solid ", ";background:", ";border-radius:0.5rem;padding:", " ", " ", " ", ";&:focus{outline:none;border:1px solid ", ";}}"], _ref28 => {
|
|
228
223
|
let {
|
|
229
224
|
$noMoneyBuys
|
|
230
|
-
} =
|
|
225
|
+
} = _ref28;
|
|
231
226
|
return $noMoneyBuys === true && (0, _styledComponents.css)(["margin-top:", ";"], (0, _spacing.default)('sm'));
|
|
232
|
-
},
|
|
227
|
+
}, _ref29 => {
|
|
233
228
|
let {
|
|
234
229
|
theme
|
|
235
|
-
} =
|
|
230
|
+
} = _ref29;
|
|
236
231
|
return theme.allBreakpoints('M');
|
|
237
|
-
}, (0, _zIndex.default)('high'),
|
|
232
|
+
}, (0, _zIndex.default)('high'), _ref30 => {
|
|
238
233
|
let {
|
|
239
234
|
theme
|
|
240
|
-
} =
|
|
235
|
+
} = _ref30;
|
|
241
236
|
return theme.color('grey');
|
|
242
|
-
},
|
|
237
|
+
}, _ref31 => {
|
|
243
238
|
let {
|
|
244
239
|
theme
|
|
245
|
-
} =
|
|
240
|
+
} = _ref31;
|
|
246
241
|
return theme.color('grey_light');
|
|
247
|
-
}, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'),
|
|
242
|
+
}, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'), _ref32 => {
|
|
248
243
|
let {
|
|
249
244
|
theme
|
|
250
|
-
} =
|
|
245
|
+
} = _ref32;
|
|
251
246
|
return theme.color('grey');
|
|
252
247
|
});
|
|
253
|
-
const
|
|
254
|
-
displayName: "
|
|
248
|
+
const MoneybuyCopy = exports.MoneybuyCopy = _styledComponents.default.p.withConfig({
|
|
249
|
+
displayName: "DonateBannerstyle__MoneybuyCopy",
|
|
255
250
|
componentId: "sc-a4o3ek-17"
|
|
256
|
-
})(["line-height:1.5;margin-top:", ";color:", ";"], (0, _spacing.default)('l'),
|
|
251
|
+
})(["line-height:1.5;margin-top:", ";color:", ";margin:", " 0 ", ";@media ", "{margin:", " 0 ", ";}"], (0, _spacing.default)('l'), _ref33 => {
|
|
257
252
|
let {
|
|
258
253
|
theme
|
|
259
|
-
} =
|
|
254
|
+
} = _ref33;
|
|
260
255
|
return theme.color('black');
|
|
261
|
-
})
|
|
256
|
+
}, (0, _spacing.default)('md'), (0, _spacing.default)('sm'), _ref34 => {
|
|
257
|
+
let {
|
|
258
|
+
theme
|
|
259
|
+
} = _ref34;
|
|
260
|
+
return theme.allBreakpoints('M');
|
|
261
|
+
}, (0, _spacing.default)('m'), (0, _spacing.default)('md'));
|
|
262
262
|
const Button = exports.Button = _styledComponents.default.button.withConfig({
|
|
263
263
|
displayName: "DonateBannerstyle__Button",
|
|
264
264
|
componentId: "sc-a4o3ek-18"
|
|
265
|
-
})(["width:100%;margin:", "
|
|
265
|
+
})(["width:100%;margin-top:", ";color:", ";font-size:", ";font-weight:bold;min-height:44px;cursor:pointer;background:", ";text-decoration:none;border-radius:0.5rem;border:none;appearance:none;:active,:focus,:hover{outline:none;background-color:", ";}"], (0, _spacing.default)('md'), _ref35 => {
|
|
266
266
|
let {
|
|
267
267
|
theme
|
|
268
268
|
} = _ref35;
|
|
@@ -283,9 +283,4 @@ const Button = exports.Button = _styledComponents.default.button.withConfig({
|
|
|
283
283
|
theme
|
|
284
284
|
} = _ref38;
|
|
285
285
|
return theme.color('coral_dark');
|
|
286
|
-
}
|
|
287
|
-
let {
|
|
288
|
-
theme
|
|
289
|
-
} = _ref39;
|
|
290
|
-
return theme.allBreakpoints('M');
|
|
291
|
-
}, (0, _spacing.default)('md'), (0, _spacing.default)('l'));
|
|
286
|
+
});
|
|
@@ -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,
|