@comicrelief/component-library 6.6.3 → 6.7.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/dist/components/Molecules/Promo/Promo.style.js +8 -8
- package/dist/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +9 -9
- package/dist/components/Organisms/Donate/Donate.js +22 -5
- package/dist/components/Organisms/Donate/Donate.md +27 -0
- package/dist/components/Organisms/Header/Nav/Nav.js +6 -1
- package/dist/components/Organisms/Header/Nav/Nav.style.js +10 -3
- package/dist/components/Organisms/Header/Nav/chevron-down.svg +3 -0
- package/package.json +1 -1
- package/src/components/Molecules/Promo/Promo.style.js +8 -8
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +9 -9
- package/src/components/Organisms/Donate/Donate.js +12 -5
- package/src/components/Organisms/Donate/Donate.md +27 -0
- package/src/components/Organisms/Header/Nav/Nav.js +10 -1
- package/src/components/Organisms/Header/Nav/Nav.style.js +9 -1
- package/src/components/Organisms/Header/Nav/chevron-down.svg +3 -0
|
@@ -26,15 +26,15 @@ var Container = _styledComponents.default.div.withConfig({
|
|
|
26
26
|
var theme = _ref.theme,
|
|
27
27
|
backgroundColor = _ref.backgroundColor;
|
|
28
28
|
return theme.color(backgroundColor);
|
|
29
|
-
}, (0, _size.media)('
|
|
29
|
+
}, (0, _size.media)('medium'), function (_ref2) {
|
|
30
30
|
var position = _ref2.position;
|
|
31
|
-
return position === 'upper' && (0, _styledComponents.css)(["clip-path:polygon(0 0,100% 0,100% 90%,0 100%);", "{clip-path:polygon(0 0,100% 0,100% 85%,0 100%);}"], (0, _size.media)('
|
|
31
|
+
return position === 'upper' && (0, _styledComponents.css)(["clip-path:polygon(0 0,100% 0,100% 90%,0 100%);", "{clip-path:polygon(0 0,100% 0,100% 85%,0 100%);}"], (0, _size.media)('medium'));
|
|
32
32
|
}, function (_ref3) {
|
|
33
33
|
var position = _ref3.position;
|
|
34
|
-
return position === 'lower' && (0, _styledComponents.css)(["clip-path:polygon(0 10%,100% 0,100% 100%,0 100%);", "{clip-path:polygon(0 15%,100% 0,100% 100%,0 100%);}"], (0, _size.media)('
|
|
34
|
+
return position === 'lower' && (0, _styledComponents.css)(["clip-path:polygon(0 10%,100% 0,100% 100%,0 100%);", "{clip-path:polygon(0 15%,100% 0,100% 100%,0 100%);}"], (0, _size.media)('medium'));
|
|
35
35
|
}, function (_ref4) {
|
|
36
36
|
var position = _ref4.position;
|
|
37
|
-
return position === 'end' && (0, _styledComponents.css)(["clip-path:polygon(0 0,100% 0,100% 90%,0 101%);border-radius:0 0 0 2rem;", "{clip-path:polygon(0 0,100% 0,100% 85%,0% 101%);border-radius:0 0 0 4rem;}"], (0, _size.media)('
|
|
37
|
+
return position === 'end' && (0, _styledComponents.css)(["clip-path:polygon(0 0,100% 0,100% 90%,0 101%);border-radius:0 0 0 2rem;", "{clip-path:polygon(0 0,100% 0,100% 85%,0% 101%);border-radius:0 0 0 4rem;}"], (0, _size.media)('medium'));
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
exports.Container = Container;
|
|
@@ -45,16 +45,16 @@ var Wrapper = _styledComponents.default.div.withConfig({
|
|
|
45
45
|
})(["width:100%;max-width:", ";height:100%;left:0;right:0;margin:0 auto;display:flex;align-items:center;", ";", "{min-height:calc(100vh - 90px);}"], _size.container.medium, function (_ref5) {
|
|
46
46
|
var copyFirst = _ref5.copyFirst;
|
|
47
47
|
return !copyFirst && 'justify-content: flex-end';
|
|
48
|
-
}, (0, _size.media)('
|
|
48
|
+
}, (0, _size.media)('medium'));
|
|
49
49
|
|
|
50
50
|
exports.Wrapper = Wrapper;
|
|
51
51
|
|
|
52
52
|
var Copy = _styledComponents.default.div.withConfig({
|
|
53
53
|
displayName: "Promostyle__Copy",
|
|
54
54
|
componentId: "sc-kk4nna-2"
|
|
55
|
-
})(["width:100%;padding:", " ", " ", ";", ";", "{width:70%;padding:", " ", ";}", "{width:50%;padding:", " ", ";}", ""], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('xl'), (0, _zIndex.default)('low'), (0, _size.media)('
|
|
55
|
+
})(["width:100%;padding:", " ", " ", ";", ";", "{width:70%;padding:", " ", ";}", "{width:50%;padding:", " ", ";}", ""], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('xl'), (0, _zIndex.default)('low'), (0, _size.media)('medium'), (0, _spacing.default)('xl'), (0, _spacing.default)('m'), (0, _size.media)('medium'), (0, _spacing.default)('xxl'), (0, _spacing.default)('m'), function (_ref6) {
|
|
56
56
|
var position = _ref6.position;
|
|
57
|
-
return position === 'lower' && (0, _styledComponents.css)(["padding:", " ", ";", "{padding:6rem ", ";margin-top:6rem;}"], (0, _spacing.default)('xl'), (0, _spacing.default)('m'), (0, _size.media)('
|
|
57
|
+
return position === 'lower' && (0, _styledComponents.css)(["padding:", " ", ";", "{padding:6rem ", ";margin-top:6rem;}"], (0, _spacing.default)('xl'), (0, _spacing.default)('m'), (0, _size.media)('medium'), (0, _spacing.default)('m'));
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
exports.Copy = Copy;
|
|
@@ -62,6 +62,6 @@ exports.Copy = Copy;
|
|
|
62
62
|
var Media = _styledComponents.default.div.withConfig({
|
|
63
63
|
displayName: "Promostyle__Media",
|
|
64
64
|
componentId: "sc-kk4nna-3"
|
|
65
|
-
})(["width:100%;height:auto;img{object-position:center;}", "{height:100%;position:absolute;}"], (0, _size.media)('
|
|
65
|
+
})(["width:100%;height:auto;img{object-position:center;}", "{height:100%;position:absolute;}"], (0, _size.media)('medium'));
|
|
66
66
|
|
|
67
67
|
exports.Media = Media;
|
|
@@ -145,7 +145,7 @@ exports[`renders Promo correctly 1`] = `
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
@media (min-width:
|
|
148
|
+
@media (min-width:1024px) {
|
|
149
149
|
.c0 {
|
|
150
150
|
-webkit-flex-direction: row;
|
|
151
151
|
-ms-flex-direction: row;
|
|
@@ -153,13 +153,13 @@ exports[`renders Promo correctly 1`] = `
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
@media (min-width:
|
|
156
|
+
@media (min-width:1024px) {
|
|
157
157
|
.c4 {
|
|
158
158
|
min-height: calc(100vh - 90px);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
@media (min-width:
|
|
162
|
+
@media (min-width:1024px) {
|
|
163
163
|
.c5 {
|
|
164
164
|
width: 70%;
|
|
165
165
|
padding: 4rem 1.5rem;
|
|
@@ -173,7 +173,7 @@ exports[`renders Promo correctly 1`] = `
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
@media (min-width:
|
|
176
|
+
@media (min-width:1024px) {
|
|
177
177
|
.c1 {
|
|
178
178
|
height: 100%;
|
|
179
179
|
position: absolute;
|
|
@@ -389,7 +389,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
@media (min-width:
|
|
392
|
+
@media (min-width:1024px) {
|
|
393
393
|
.c0 {
|
|
394
394
|
-webkit-flex-direction: row;
|
|
395
395
|
-ms-flex-direction: row;
|
|
@@ -397,7 +397,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
@media (min-width:
|
|
400
|
+
@media (min-width:1024px) {
|
|
401
401
|
.c0 {
|
|
402
402
|
-webkit-clip-path: polygon(0 0,100% 0,100% 85%,0% 101%);
|
|
403
403
|
clip-path: polygon(0 0,100% 0,100% 85%,0% 101%);
|
|
@@ -405,13 +405,13 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
@media (min-width:
|
|
408
|
+
@media (min-width:1024px) {
|
|
409
409
|
.c4 {
|
|
410
410
|
min-height: calc(100vh - 90px);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
@media (min-width:
|
|
414
|
+
@media (min-width:1024px) {
|
|
415
415
|
.c5 {
|
|
416
416
|
width: 70%;
|
|
417
417
|
padding: 4rem 1.5rem;
|
|
@@ -425,7 +425,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
@media (min-width:
|
|
428
|
+
@media (min-width:1024px) {
|
|
429
429
|
.c1 {
|
|
430
430
|
height: 100%;
|
|
431
431
|
position: absolute;
|
|
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
|
|
12
14
|
var _reactResponsive = require("react-responsive");
|
|
13
15
|
|
|
@@ -21,6 +23,10 @@ var _Form = _interopRequireDefault(require("./Form/Form"));
|
|
|
21
23
|
|
|
22
24
|
var _Donate = require("./Donate.style");
|
|
23
25
|
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
24
30
|
var Donate = function Donate(_ref) {
|
|
25
31
|
var alt = _ref.alt,
|
|
26
32
|
cartID = _ref.cartID,
|
|
@@ -44,15 +50,26 @@ var Donate = function Donate(_ref) {
|
|
|
44
50
|
PopUpText = _ref.PopUpText,
|
|
45
51
|
chooseAmountText = _ref.chooseAmountText,
|
|
46
52
|
isDesktopOverride = _ref.isDesktopOverride;
|
|
47
|
-
// Can't assign this conditionally due to Hook rules..
|
|
48
53
|
var isDesktop = (0, _reactResponsive.useMediaQuery)({
|
|
49
54
|
query: "(min-width: ".concat(_size.screen.medium, ")")
|
|
50
|
-
}); //
|
|
55
|
+
}); // To let us store any updated override, and force a re-render
|
|
56
|
+
|
|
57
|
+
var _useState = (0, _react.useState)(null),
|
|
58
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
59
|
+
overrideValue = _useState2[0],
|
|
60
|
+
setOverrideValue = _useState2[1]; // Store the updated override value
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
_react.default.useEffect(function () {
|
|
64
|
+
setOverrideValue(isDesktopOverride);
|
|
65
|
+
}, [isDesktopOverride]); // If a boolean value has been passed, let it replace our 'internal' value
|
|
66
|
+
|
|
51
67
|
|
|
52
|
-
|
|
68
|
+
isDesktop = overrideValue !== null ? overrideValue : isDesktop;
|
|
53
69
|
return /*#__PURE__*/_react.default.createElement(_Donate.Container, {
|
|
54
70
|
backgroundColor: backgroundColor,
|
|
55
|
-
id: mbshipID
|
|
71
|
+
id: mbshipID,
|
|
72
|
+
key: overrideValue
|
|
56
73
|
}, !isDesktop && mobileImages ? /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
57
74
|
backgroundColor: backgroundColor,
|
|
58
75
|
image: mobileImage,
|
|
@@ -224,3 +224,30 @@ import data from './dev-data/data-single';
|
|
|
224
224
|
chooseAmountText="Overridden via the 'choose amount text' props"
|
|
225
225
|
/>;
|
|
226
226
|
```
|
|
227
|
+
|
|
228
|
+
## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
import data from './dev-data/data';
|
|
232
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
233
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
234
|
+
|
|
235
|
+
<Donate
|
|
236
|
+
alt="Background image"
|
|
237
|
+
backgroundColor="red"
|
|
238
|
+
formAlignRight={true}
|
|
239
|
+
imageLow={desktopPictures.imageLow}
|
|
240
|
+
images={desktopPictures.images}
|
|
241
|
+
mobileImageLow={mobilePictures.imageLow}
|
|
242
|
+
mobileImages={mobilePictures.images}
|
|
243
|
+
data={data}
|
|
244
|
+
mbshipID="mship-1"
|
|
245
|
+
donateLink="https://donation.comicrelief.com/"
|
|
246
|
+
clientID="donate"
|
|
247
|
+
cartID="default-comicrelief"
|
|
248
|
+
title="Donate Now"
|
|
249
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
250
|
+
otherDescription="will help us fund amazing projects in the UK and around the world."
|
|
251
|
+
isDesktopOverride={false}
|
|
252
|
+
/>;
|
|
253
|
+
```
|
|
@@ -25,6 +25,8 @@ var _internalLinkHelper = require("../../../../utils/internalLinkHelper");
|
|
|
25
25
|
|
|
26
26
|
var _whiteListed = _interopRequireDefault(require("../../../../utils/whiteListed"));
|
|
27
27
|
|
|
28
|
+
var _chevronDown = _interopRequireDefault(require("./chevron-down.svg"));
|
|
29
|
+
|
|
28
30
|
var _Nav = require("./Nav.style");
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -127,7 +129,10 @@ var MainNav = function MainNav(_ref) {
|
|
|
127
129
|
rel: relNoopener,
|
|
128
130
|
"aria-haspopup": hasPopUp,
|
|
129
131
|
onKeyUp: keyPressed(group.title)
|
|
130
|
-
}, thisFirstChild.title
|
|
132
|
+
}, thisFirstChild.title, hasSubMenu && /*#__PURE__*/_react.default.createElement(_Nav.ChevronWrapper, null, /*#__PURE__*/_react.default.createElement("img", {
|
|
133
|
+
src: _chevronDown.default,
|
|
134
|
+
alt: "chevron down icon"
|
|
135
|
+
})))), hasSubMenu && /*#__PURE__*/_react.default.createElement(_Nav.SubNavMenu, {
|
|
131
136
|
role: "list",
|
|
132
137
|
isKeyPressed: !!isKeyPressed[group.title],
|
|
133
138
|
isSubMenuOpen: !!isSubMenuOpen[group.id]
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SubNavLinkUnderline = exports.SubNavLink = exports.SubNavItem = exports.SubNavMenu = exports.NavLink = exports.NavItem = exports.NavMenu = exports.Nav = void 0;
|
|
8
|
+
exports.ChevronWrapper = exports.SubNavLinkUnderline = exports.SubNavLink = exports.SubNavItem = exports.SubNavMenu = exports.NavLink = exports.NavItem = exports.NavMenu = exports.Nav = void 0;
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
|
|
@@ -143,7 +143,7 @@ exports.NavMenu = NavMenu;
|
|
|
143
143
|
var NavLink = (0, _styledComponents.default)(NavLinkClass).withConfig({
|
|
144
144
|
displayName: "Navstyle__NavLink",
|
|
145
145
|
componentId: "sc-1ss3uk2-7"
|
|
146
|
-
})(["font-family:", ";@media ", "{padding:10px 0;height:auto;:focus + ", "{display:flex;}}"], function (_ref19) {
|
|
146
|
+
})(["display:flex;gap:4px;font-family:", ";@media ", "{padding:10px 0;height:auto;:focus + ", "{display:flex;}}"], function (_ref19) {
|
|
147
147
|
var theme = _ref19.theme;
|
|
148
148
|
return theme.fontFamilies(theme.font.regular);
|
|
149
149
|
}, function (_ref20) {
|
|
@@ -170,4 +170,11 @@ var NavItem = _styledComponents.default.li.withConfig({
|
|
|
170
170
|
return theme.color('black');
|
|
171
171
|
}, SubNavMenu);
|
|
172
172
|
|
|
173
|
-
exports.NavItem = NavItem;
|
|
173
|
+
exports.NavItem = NavItem;
|
|
174
|
+
|
|
175
|
+
var ChevronWrapper = _styledComponents.default.div.withConfig({
|
|
176
|
+
displayName: "Navstyle__ChevronWrapper",
|
|
177
|
+
componentId: "sc-1ss3uk2-9"
|
|
178
|
+
})(["width:12px;padding-top:2px;"]);
|
|
179
|
+
|
|
180
|
+
exports.ChevronWrapper = ChevronWrapper;
|
package/package.json
CHANGED
|
@@ -10,25 +10,25 @@ const Container = styled.div`
|
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
|
|
13
|
-
${media('
|
|
13
|
+
${media('medium')} {
|
|
14
14
|
flex-direction: row;
|
|
15
15
|
}
|
|
16
16
|
${({ position }) => position === 'upper' && css`
|
|
17
17
|
clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
|
|
18
|
-
${media('
|
|
18
|
+
${media('medium')} {
|
|
19
19
|
clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
|
|
20
20
|
}
|
|
21
21
|
`}
|
|
22
22
|
${({ position }) => position === 'lower' && css`
|
|
23
23
|
clip-path: polygon(0 10%,100% 0,100% 100%,0 100%);
|
|
24
|
-
${media('
|
|
24
|
+
${media('medium')} {
|
|
25
25
|
clip-path: polygon(0 15%,100% 0,100% 100%,0 100%);
|
|
26
26
|
}
|
|
27
27
|
`}
|
|
28
28
|
${({ position }) => position === 'end' && css`
|
|
29
29
|
clip-path: polygon(0 0, 100% 0, 100% 90%, 0 101%);
|
|
30
30
|
border-radius: 0 0 0 2rem;
|
|
31
|
-
${media('
|
|
31
|
+
${media('medium')} {
|
|
32
32
|
clip-path: polygon(0 0,100% 0,100% 85%,0% 101%);
|
|
33
33
|
border-radius: 0 0 0 4rem;
|
|
34
34
|
}
|
|
@@ -45,7 +45,7 @@ const Wrapper = styled.div`
|
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
47
|
${({ copyFirst }) => !copyFirst && 'justify-content: flex-end'};
|
|
48
|
-
${media('
|
|
48
|
+
${media('medium')} {
|
|
49
49
|
min-height: calc(100vh - 90px);
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
@@ -54,7 +54,7 @@ const Copy = styled.div`
|
|
|
54
54
|
width: 100%;
|
|
55
55
|
padding: ${spacing('m')} ${spacing('m')} ${spacing('xl')};
|
|
56
56
|
${zIndex('low')};
|
|
57
|
-
${media('
|
|
57
|
+
${media('medium')} {
|
|
58
58
|
width: 70%;
|
|
59
59
|
padding: ${spacing('xl')} ${spacing('m')};
|
|
60
60
|
}
|
|
@@ -64,7 +64,7 @@ const Copy = styled.div`
|
|
|
64
64
|
}
|
|
65
65
|
${({ position }) => position === 'lower' && css`
|
|
66
66
|
padding: ${spacing('xl')} ${spacing('m')};
|
|
67
|
-
${media('
|
|
67
|
+
${media('medium')} {
|
|
68
68
|
padding: 6rem ${spacing('m')};
|
|
69
69
|
margin-top: 6rem;
|
|
70
70
|
}
|
|
@@ -77,7 +77,7 @@ const Media = styled.div`
|
|
|
77
77
|
img {
|
|
78
78
|
object-position: center;
|
|
79
79
|
}
|
|
80
|
-
${media('
|
|
80
|
+
${media('medium')} {
|
|
81
81
|
height: 100%;
|
|
82
82
|
position: absolute;
|
|
83
83
|
}
|
|
@@ -145,7 +145,7 @@ exports[`renders Promo correctly 1`] = `
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
@media (min-width:
|
|
148
|
+
@media (min-width:1024px) {
|
|
149
149
|
.c0 {
|
|
150
150
|
-webkit-flex-direction: row;
|
|
151
151
|
-ms-flex-direction: row;
|
|
@@ -153,13 +153,13 @@ exports[`renders Promo correctly 1`] = `
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
@media (min-width:
|
|
156
|
+
@media (min-width:1024px) {
|
|
157
157
|
.c4 {
|
|
158
158
|
min-height: calc(100vh - 90px);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
@media (min-width:
|
|
162
|
+
@media (min-width:1024px) {
|
|
163
163
|
.c5 {
|
|
164
164
|
width: 70%;
|
|
165
165
|
padding: 4rem 1.5rem;
|
|
@@ -173,7 +173,7 @@ exports[`renders Promo correctly 1`] = `
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
@media (min-width:
|
|
176
|
+
@media (min-width:1024px) {
|
|
177
177
|
.c1 {
|
|
178
178
|
height: 100%;
|
|
179
179
|
position: absolute;
|
|
@@ -389,7 +389,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
@media (min-width:
|
|
392
|
+
@media (min-width:1024px) {
|
|
393
393
|
.c0 {
|
|
394
394
|
-webkit-flex-direction: row;
|
|
395
395
|
-ms-flex-direction: row;
|
|
@@ -397,7 +397,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
@media (min-width:
|
|
400
|
+
@media (min-width:1024px) {
|
|
401
401
|
.c0 {
|
|
402
402
|
-webkit-clip-path: polygon(0 0,100% 0,100% 85%,0% 101%);
|
|
403
403
|
clip-path: polygon(0 0,100% 0,100% 85%,0% 101%);
|
|
@@ -405,13 +405,13 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
@media (min-width:
|
|
408
|
+
@media (min-width:1024px) {
|
|
409
409
|
.c4 {
|
|
410
410
|
min-height: calc(100vh - 90px);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
@media (min-width:
|
|
414
|
+
@media (min-width:1024px) {
|
|
415
415
|
.c5 {
|
|
416
416
|
width: 70%;
|
|
417
417
|
padding: 4rem 1.5rem;
|
|
@@ -425,7 +425,7 @@ exports[`renders Promo correctly end position 1`] = `
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
@media (min-width:
|
|
428
|
+
@media (min-width:1024px) {
|
|
429
429
|
.c1 {
|
|
430
430
|
height: 100%;
|
|
431
431
|
position: absolute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { useMediaQuery } from 'react-responsive';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
@@ -38,14 +38,21 @@ const Donate = ({
|
|
|
38
38
|
chooseAmountText,
|
|
39
39
|
isDesktopOverride
|
|
40
40
|
}) => {
|
|
41
|
-
// Can't assign this conditionally due to Hook rules..
|
|
42
41
|
let isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
|
|
43
42
|
|
|
44
|
-
//
|
|
45
|
-
|
|
43
|
+
// To let us store any updated override, and force a re-render
|
|
44
|
+
const [overrideValue, setOverrideValue] = useState(null);
|
|
45
|
+
|
|
46
|
+
// Store the updated override value
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
setOverrideValue(isDesktopOverride);
|
|
49
|
+
}, [isDesktopOverride]);
|
|
50
|
+
|
|
51
|
+
// If a boolean value has been passed, let it replace our 'internal' value
|
|
52
|
+
isDesktop = overrideValue !== null ? overrideValue : isDesktop;
|
|
46
53
|
|
|
47
54
|
return (
|
|
48
|
-
<Container backgroundColor={backgroundColor} id={mbshipID}>
|
|
55
|
+
<Container backgroundColor={backgroundColor} id={mbshipID} key={overrideValue}>
|
|
49
56
|
{!isDesktop && mobileImages ? (
|
|
50
57
|
<Picture
|
|
51
58
|
backgroundColor={backgroundColor}
|
|
@@ -224,3 +224,30 @@ import data from './dev-data/data-single';
|
|
|
224
224
|
chooseAmountText="Overridden via the 'choose amount text' props"
|
|
225
225
|
/>;
|
|
226
226
|
```
|
|
227
|
+
|
|
228
|
+
## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
import data from './dev-data/data';
|
|
232
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
233
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
234
|
+
|
|
235
|
+
<Donate
|
|
236
|
+
alt="Background image"
|
|
237
|
+
backgroundColor="red"
|
|
238
|
+
formAlignRight={true}
|
|
239
|
+
imageLow={desktopPictures.imageLow}
|
|
240
|
+
images={desktopPictures.images}
|
|
241
|
+
mobileImageLow={mobilePictures.imageLow}
|
|
242
|
+
mobileImages={mobilePictures.images}
|
|
243
|
+
data={data}
|
|
244
|
+
mbshipID="mship-1"
|
|
245
|
+
donateLink="https://donation.comicrelief.com/"
|
|
246
|
+
clientID="donate"
|
|
247
|
+
cartID="default-comicrelief"
|
|
248
|
+
title="Donate Now"
|
|
249
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
250
|
+
otherDescription="will help us fund amazing projects in the UK and around the world."
|
|
251
|
+
isDesktopOverride={false}
|
|
252
|
+
/>;
|
|
253
|
+
```
|
|
@@ -7,6 +7,7 @@ import { sizes } from '../../../../theme/shared/breakpoint';
|
|
|
7
7
|
import NavHelper from '../../../../utils/navHelper';
|
|
8
8
|
import { InternalLinkHelper } from '../../../../utils/internalLinkHelper';
|
|
9
9
|
import whiteListed from '../../../../utils/whiteListed';
|
|
10
|
+
import ChevronDown from './chevron-down.svg';
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
Nav,
|
|
@@ -16,7 +17,8 @@ import {
|
|
|
16
17
|
SubNavMenu,
|
|
17
18
|
SubNavItem,
|
|
18
19
|
SubNavLink,
|
|
19
|
-
SubNavLinkUnderline
|
|
20
|
+
SubNavLinkUnderline,
|
|
21
|
+
ChevronWrapper
|
|
20
22
|
} from './Nav.style';
|
|
21
23
|
|
|
22
24
|
const MainNav = ({ navItems }) => {
|
|
@@ -109,6 +111,13 @@ const MainNav = ({ navItems }) => {
|
|
|
109
111
|
onKeyUp={keyPressed(group.title)}
|
|
110
112
|
>
|
|
111
113
|
{thisFirstChild.title}
|
|
114
|
+
{hasSubMenu
|
|
115
|
+
&& (
|
|
116
|
+
<ChevronWrapper>
|
|
117
|
+
<img src={ChevronDown} alt="chevron down icon" />
|
|
118
|
+
</ChevronWrapper>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
112
121
|
</NavLink>
|
|
113
122
|
</Text>
|
|
114
123
|
)}
|
|
@@ -162,6 +162,8 @@ const NavMenu = styled.ul`
|
|
|
162
162
|
* Menu item link
|
|
163
163
|
*/
|
|
164
164
|
const NavLink = styled(NavLinkClass)`
|
|
165
|
+
display: flex;
|
|
166
|
+
gap: 4px;
|
|
165
167
|
font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
|
|
166
168
|
@media ${({ theme }) => theme.breakpoint('nav')} {
|
|
167
169
|
padding: 10px 0;
|
|
@@ -227,6 +229,11 @@ const NavItem = styled.li`
|
|
|
227
229
|
}
|
|
228
230
|
`;
|
|
229
231
|
|
|
232
|
+
const ChevronWrapper = styled.div`
|
|
233
|
+
width: 12px;
|
|
234
|
+
padding-top: 2px;
|
|
235
|
+
`;
|
|
236
|
+
|
|
230
237
|
export {
|
|
231
238
|
Nav,
|
|
232
239
|
NavMenu,
|
|
@@ -235,5 +242,6 @@ export {
|
|
|
235
242
|
SubNavMenu,
|
|
236
243
|
SubNavItem,
|
|
237
244
|
SubNavLink,
|
|
238
|
-
SubNavLinkUnderline
|
|
245
|
+
SubNavLinkUnderline,
|
|
246
|
+
ChevronWrapper
|
|
239
247
|
};
|