@comicrelief/component-library 7.22.1 → 7.23.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/cypress/e2e/components/organisms/impactSlider.cy.js +72 -0
- package/dist/components/Atoms/Button/Button.js +4 -16
- package/dist/components/Atoms/Button/Button.test.js +0 -5
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +14 -31
- package/dist/components/Atoms/Checkbox/Checkbox.js +4 -17
- package/dist/components/Atoms/Checkbox/Checkbox.test.js +0 -5
- package/dist/components/Atoms/Confetti/Confetti.js +8 -23
- package/dist/components/Atoms/Confetti/_TriggerConfetti.js +5 -13
- package/dist/components/Atoms/ErrorText/ErrorText.js +2 -14
- package/dist/components/Atoms/ErrorText/ErrorText.test.js +0 -5
- package/dist/components/Atoms/Icons/Arrow.js +7 -21
- package/dist/components/Atoms/Icons/AtSign.js +4 -14
- package/dist/components/Atoms/Icons/Chevron.js +7 -21
- package/dist/components/Atoms/Icons/Curve.js +1 -6
- package/dist/components/Atoms/Icons/Download.js +4 -14
- package/dist/components/Atoms/Icons/External.js +4 -14
- package/dist/components/Atoms/Icons/Favourite.js +4 -14
- package/dist/components/Atoms/Icons/Internal.js +4 -14
- package/dist/components/Atoms/Icons/index.js +14 -22
- package/dist/components/Atoms/Input/Input.js +15 -35
- package/dist/components/Atoms/Input/input.test.js +0 -5
- package/dist/components/Atoms/Label/Label.js +12 -24
- package/dist/components/Atoms/Link/Link.js +18 -35
- package/dist/components/Atoms/Link/Link.style.js +9 -25
- package/dist/components/Atoms/Link/Link.test.js +0 -6
- package/dist/components/Atoms/Logo/Logo.js +5 -22
- package/dist/components/Atoms/Logo/Logo.test.js +0 -5
- package/dist/components/Atoms/Pagination/Item/Item.js +3 -11
- package/dist/components/Atoms/Pagination/Item/Item.style.js +18 -30
- package/dist/components/Atoms/Pagination/List/List.js +10 -21
- package/dist/components/Atoms/Pagination/Pagination.js +25 -47
- package/dist/components/Atoms/Pagination/Pagination.test.js +0 -5
- package/dist/components/Atoms/Pagination/Utils/PaginationCalculator.js +14 -30
- package/dist/components/Atoms/Picture/Picture.js +19 -39
- package/dist/components/Atoms/Picture/Picture.test.js +0 -6
- package/dist/components/Atoms/RadioButton/RadioButton.js +6 -18
- package/dist/components/Atoms/RadioButton/RadioButton.test.js +0 -5
- package/dist/components/Atoms/RichText/RichText.js +4 -15
- package/dist/components/Atoms/RichText/RichText.test.js +0 -5
- package/dist/components/Atoms/Select/Select.js +19 -39
- package/dist/components/Atoms/Select/Select.test.js +0 -5
- package/dist/components/Atoms/SocialIcons/Icon/Icon.js +6 -18
- package/dist/components/Atoms/SocialIcons/SocialIcons.js +3 -17
- package/dist/components/Atoms/SocialIcons/SocialIcons.test.js +0 -5
- package/dist/components/Atoms/SocialIcons/Utils/Icons.js +2 -9
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +2 -5
- package/dist/components/Atoms/Text/Text.js +16 -29
- package/dist/components/Atoms/Text/Text.test.js +0 -5
- package/dist/components/Atoms/TextArea/TextArea.js +10 -25
- package/dist/components/Atoms/TextArea/TextArea.test.js +0 -5
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +26 -53
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js +8 -28
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.test.js +0 -6
- package/dist/components/Molecules/Accordion/Accordion.js +8 -29
- package/dist/components/Molecules/Accordion/Accordion.test.js +0 -6
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +14 -38
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +0 -6
- package/dist/components/Molecules/Banner/Banner.js +3 -13
- package/dist/components/Molecules/Banner/Banner.test.js +0 -6
- package/dist/components/Molecules/Box/Box.js +9 -22
- package/dist/components/Molecules/Box/Box.test.js +0 -6
- package/dist/components/Molecules/Card/Card.js +11 -24
- package/dist/components/Molecules/Card/Card.test.js +0 -6
- package/dist/components/Molecules/CardDs/CardDs.js +17 -41
- package/dist/components/Molecules/CardDs/CardDs.test.js +0 -7
- package/dist/components/Molecules/Chip/Chip.js +4 -10
- package/dist/components/Molecules/Chip/Chip.style.js +8 -48
- package/dist/components/Molecules/Chip/Chip.test.js +0 -6
- package/dist/components/Molecules/Countdown/Countdown.js +17 -32
- package/dist/components/Molecules/Countdown/Countdown.style.js +4 -13
- package/dist/components/Molecules/Descriptor/Descriptor.js +6 -50
- package/dist/components/Molecules/Descriptor/Descriptor.test.js +0 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.js +2 -8
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.style.js +4 -13
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +0 -6
- package/dist/components/Molecules/HeroBanner/HeroBanner.js +4 -13
- package/dist/components/Molecules/InfoBanner/InfoBanner.js +8 -19
- package/dist/components/Molecules/InfoBanner/InfoBanner.test.js +0 -5
- package/dist/components/Molecules/Logos/Logos.js +1 -11
- package/dist/components/Molecules/Lookup/Lookup.js +25 -57
- package/dist/components/Molecules/PartnerLink/PartnerLink.js +3 -14
- package/dist/components/Molecules/PartnerLink/PartnerLink.style.js +4 -13
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +0 -7
- package/dist/components/Molecules/Promo/Promo.js +33 -47
- package/dist/components/Molecules/Promo/Promo.md +2 -1
- package/dist/components/Molecules/Promo/Promo.style.js +12 -37
- package/dist/components/Molecules/Promo/Promo.test.js +0 -8
- package/dist/components/Molecules/Promo/_ProgressRing.js +7 -20
- package/dist/components/Molecules/Promo/_PromoVideo.js +39 -53
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +2 -11
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +14 -40
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +6 -23
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.test.js +0 -5
- package/dist/components/Molecules/SearchInput/SearchInput.js +4 -12
- package/dist/components/Molecules/SearchInput/SearchInput.style.js +7 -25
- package/dist/components/Molecules/SearchInput/SearchInput.test.js +0 -5
- package/dist/components/Molecules/SearchResult/SearchResult.js +11 -25
- package/dist/components/Molecules/SearchResult/SearchResult.test.js +0 -6
- package/dist/components/Molecules/ShareButton/ShareButton.js +10 -23
- package/dist/components/Molecules/ShareButton/ShareButton.style.js +6 -21
- package/dist/components/Molecules/ShareButton/ShareButton.test.js +0 -5
- package/dist/components/Molecules/ShareButton/assets/ShareIcons.js +1 -6
- package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +4 -25
- package/dist/components/Molecules/SingleMessage/SingleMessage.js +48 -68
- package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +19 -47
- package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +0 -8
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +22 -46
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +13 -44
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +0 -8
- package/dist/components/Molecules/Typeahead/Typeahead.js +25 -51
- package/dist/components/Molecules/Typeahead/Typeahead.test.js +0 -12
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +14 -28
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +0 -6
- package/dist/components/Organisms/CookieBanner/CookieBanner.js +3 -9
- package/dist/components/Organisms/CookieBanner/CookieBanner.style.js +6 -18
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +0 -5
- package/dist/components/Organisms/Donate/Donate.js +36 -48
- package/dist/components/Organisms/Donate/Donate.style.js +23 -71
- package/dist/components/Organisms/Donate/Donate.test.js +0 -8
- package/dist/components/Organisms/Donate/Form/Form.js +53 -80
- package/dist/components/Organisms/Donate/Form/PopUpComponent.js +9 -27
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +4 -12
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +7 -25
- package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +7 -21
- package/dist/components/Organisms/Donate/dev-data/data-high-value.js +2 -3
- package/dist/components/Organisms/Donate/dev-data/data-single.js +2 -3
- package/dist/components/Organisms/Donate/dev-data/data.js +2 -3
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +12 -37
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +0 -9
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +3 -24
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +19 -32
- package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +6 -18
- package/dist/components/Organisms/EmailSignUp/_TextInput.js +7 -16
- package/dist/components/Organisms/Footer/Footer.js +5 -17
- package/dist/components/Organisms/Footer/Footer.style.js +10 -35
- package/dist/components/Organisms/Footer/Footer.test.js +1 -7
- package/dist/components/Organisms/Footer/Nav/Nav.js +15 -39
- package/dist/components/Organisms/Footer/Nav/Nav.style.js +16 -37
- package/dist/components/Organisms/Footer/data/data.js +2 -3
- package/dist/components/Organisms/Footer/data/footerCopy.js +2 -3
- package/dist/components/Organisms/Header/Burger/BurgerMenu.js +3 -8
- package/dist/components/Organisms/Header/Burger/BurgerMenu.style.js +8 -19
- package/dist/components/Organisms/Header/Header.js +4 -14
- package/dist/components/Organisms/Header/Header.style.js +5 -22
- package/dist/components/Organisms/Header/Nav/Nav.js +19 -44
- package/dist/components/Organisms/Header/Nav/Nav.style.js +19 -46
- package/dist/components/Organisms/Header/data/data.js +2 -3
- package/dist/components/Organisms/Header/header.test.js +5 -2
- package/dist/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +61 -0
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.js +71 -0
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.md +42 -0
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +56 -0
- package/dist/components/Organisms/ImpactSlider/Slider.style.js +30 -0
- package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +42 -0
- package/dist/components/Organisms/ImpactSlider/_Slider.js +32 -0
- package/dist/components/Organisms/ImpactSlider/_utils.js +30 -0
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +15 -54
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDSForm.js +11 -20
- package/dist/components/Organisms/MarketingPreferencesDS/_AssociatedFields.js +1 -2
- package/dist/components/Organisms/MarketingPreferencesDS/_CheckAnswer.js +12 -23
- package/dist/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +4 -14
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +23 -35
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPrefsConfig.js +10 -19
- package/dist/components/Organisms/MarketingPreferencesDS/_TextInput.js +7 -16
- package/dist/components/Organisms/Membership/Form/Form.js +50 -83
- package/dist/components/Organisms/Membership/Membership.js +13 -21
- package/dist/components/Organisms/Membership/Membership.style.js +21 -63
- package/dist/components/Organisms/Membership/Membership.test.js +0 -7
- package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +9 -21
- package/dist/components/Organisms/Membership/dev-data/data.js +2 -3
- package/dist/hoc/shallowWithTheme.js +0 -6
- package/dist/index.js +134 -187
- package/dist/styleguide/CRLogo.js +1 -9
- package/dist/styleguide/StyleGuideRenderer.js +6 -10
- package/dist/styleguide/ThemeWrapper.js +1 -8
- package/dist/styleguide/data/data.js +20 -5
- package/dist/theme/ThemeProvider.js +1 -5
- package/dist/theme/crTheme/buttonColors.js +2 -11
- package/dist/theme/crTheme/colors.js +3 -9
- package/dist/theme/crTheme/fontSizes.js +2 -6
- package/dist/theme/crTheme/linkStyles.js +2 -11
- package/dist/theme/crTheme/theme.js +2 -11
- package/dist/theme/shared/breakpoint.js +4 -9
- package/dist/theme/shared/fontFamilies.js +2 -7
- package/dist/theme/shared/hideVisually.js +1 -4
- package/dist/theme/shared/size.js +5 -11
- package/dist/theme/shared/spacing.js +1 -5
- package/dist/theme/shared/zIndex.js +1 -8
- package/dist/theme/srTheme/buttonColors.js +2 -11
- package/dist/theme/srTheme/colors.js +3 -9
- package/dist/theme/srTheme/fontSizes.js +2 -6
- package/dist/theme/srTheme/linkStyles.js +2 -11
- package/dist/theme/srTheme/theme.js +2 -11
- package/dist/utils/Membership.js +11 -28
- package/dist/utils/ShareButton/sharePopUpHelper.js +3 -8
- package/dist/utils/ShareButton/shareTracking.js +1 -5
- package/dist/utils/ShareButton/shareUrlHelper.js +3 -5
- package/dist/utils/allowListed.js +1 -5
- package/dist/utils/allowListed.test.js +0 -2
- package/dist/utils/internalLinkHelper.js +11 -20
- package/dist/utils/navHelper.js +1 -6
- package/package.json +2 -1
- package/react-range-slider-input.d.ts +2 -0
- package/src/components/Molecules/Promo/Promo.md +2 -1
- package/src/components/Molecules/Promo/_PromoVideo.js +6 -4
- package/src/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +96 -0
- package/src/components/Organisms/ImpactSlider/ImpactSlider.js +92 -0
- package/src/components/Organisms/ImpactSlider/ImpactSlider.md +42 -0
- package/src/components/Organisms/ImpactSlider/ImpactSlider.style.js +72 -0
- package/src/components/Organisms/ImpactSlider/Slider.style.js +70 -0
- package/src/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +43 -0
- package/src/components/Organisms/ImpactSlider/_Slider.js +39 -0
- package/src/components/Organisms/ImpactSlider/_utils.js +32 -0
- package/src/index.js +1 -0
- package/src/styleguide/data/data.js +26 -1
|
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/* Handles issues related to screen/browser positions on dual-screen setups- http://www.xtf.dk/ */
|
|
9
8
|
var popUpCentre = function popUpCentre(url, popUpWidth, popUpHeight) {
|
|
10
9
|
var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screen.left;
|
|
11
10
|
var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screen.top;
|
|
12
11
|
var browserWidth;
|
|
13
12
|
var browserHeight;
|
|
14
|
-
|
|
15
13
|
if (window.innerWidth) {
|
|
16
14
|
browserWidth = window.innerWidth;
|
|
17
15
|
} else if (document.documentElement.clientWidth) {
|
|
@@ -19,7 +17,6 @@ var popUpCentre = function popUpCentre(url, popUpWidth, popUpHeight) {
|
|
|
19
17
|
} else {
|
|
20
18
|
browserWidth = window.screen.width;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
if (window.innerHeight) {
|
|
24
21
|
browserHeight = window.innerHeight;
|
|
25
22
|
} else if (document.documentElement.clientHeight) {
|
|
@@ -27,15 +24,13 @@ var popUpCentre = function popUpCentre(url, popUpWidth, popUpHeight) {
|
|
|
27
24
|
} else {
|
|
28
25
|
browserHeight = window.screen.height;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
var popUpLeft = browserWidth / 2 - popUpWidth / 2 + dualScreenLeft;
|
|
32
28
|
var popUpTop = browserHeight / 2 - popUpHeight / 2 + dualScreenTop;
|
|
33
|
-
var newWindow = window.open(url, '', "width=".concat(popUpWidth, ", height=").concat(popUpHeight, ", top=").concat(popUpTop, ", left=").concat(popUpLeft));
|
|
29
|
+
var newWindow = window.open(url, '', "width=".concat(popUpWidth, ", height=").concat(popUpHeight, ", top=").concat(popUpTop, ", left=").concat(popUpLeft));
|
|
34
30
|
|
|
31
|
+
// Shift browser focus to newWindow
|
|
35
32
|
if (window.focus) {
|
|
36
33
|
newWindow.focus();
|
|
37
34
|
}
|
|
38
35
|
};
|
|
39
|
-
|
|
40
|
-
var _default = popUpCentre;
|
|
41
|
-
exports.default = _default;
|
|
36
|
+
var _default = exports.default = popUpCentre;
|
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var shareTracking = function shareTracking(channel) {
|
|
9
8
|
if (!window.dataLayer) {
|
|
10
9
|
window.dataLayer = [];
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
window.dataLayer.push({
|
|
14
12
|
event: 'btn_social-share',
|
|
15
13
|
action: channel
|
|
16
14
|
});
|
|
17
15
|
};
|
|
18
|
-
|
|
19
|
-
var _default = shareTracking;
|
|
20
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = shareTracking;
|
|
@@ -4,18 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/* Determine where to grab the URL, depending on the component type and values supplied */
|
|
9
8
|
var shareUrlHelper = function shareUrlHelper(urlToShare, typeOfShare) {
|
|
10
9
|
// Encode the URL so we can happily pass it as a parameter, fragments and all
|
|
11
|
-
var urlToShareEncoded = encodeURIComponent(urlToShare);
|
|
10
|
+
var urlToShareEncoded = encodeURIComponent(urlToShare);
|
|
12
11
|
|
|
12
|
+
// Construct all share urls
|
|
13
13
|
var shareURLs = {
|
|
14
14
|
Twitter: "http://www.twitter.com/intent/tweet?url=".concat(urlToShareEncoded),
|
|
15
15
|
Facebook: "https://www.facebook.com/sharer/sharer.php?u=".concat(urlToShareEncoded)
|
|
16
16
|
};
|
|
17
17
|
return shareURLs[typeOfShare];
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
var _default = shareUrlHelper;
|
|
21
|
-
exports.default = _default;
|
|
19
|
+
var _default = exports.default = shareUrlHelper;
|
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var allowList = ['https://giftaid.comicrelief.com', 'https://donation.comicrelief.com', 'https://www.comicrelief.com', 'https://www.sportrelief.com', 'https://app.beapplied.com/org/comic-relief', 'stories.comicrelief.com', 'https://form.typeform.com'];
|
|
8
|
-
|
|
9
8
|
var allowListed = function allowListed(url) {
|
|
10
9
|
if (url !== undefined && url !== null && allowList.some(function (v) {
|
|
11
10
|
return url.indexOf(v) >= 0;
|
|
12
11
|
})) {
|
|
13
12
|
return true;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
return false;
|
|
17
15
|
};
|
|
18
|
-
|
|
19
|
-
var _default = allowListed;
|
|
20
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = allowListed;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _allowListed = _interopRequireDefault(require("./allowListed"));
|
|
6
|
-
|
|
7
5
|
it('link is allowListed', function () {
|
|
8
6
|
expect((0, _allowListed.default)('https://www.comicrelief.com/home')).toBe(true);
|
|
9
7
|
});
|
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.getDomain = exports.InternalLinkHelper = void 0;
|
|
9
|
-
|
|
10
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var domainRegEx = new RegExp('(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]');
|
|
13
|
-
|
|
14
|
-
var InternalLinkHelper = function InternalLinkHelper(link) {
|
|
10
|
+
var InternalLinkHelper = exports.InternalLinkHelper = function InternalLinkHelper(link) {
|
|
15
11
|
// Check our URL for a domain pattern, if so return it
|
|
16
12
|
if (domainRegEx.test(link)) {
|
|
17
13
|
return link;
|
|
18
|
-
}
|
|
19
|
-
|
|
14
|
+
}
|
|
20
15
|
|
|
16
|
+
// If domain-free and internal, prefix it with slash if it doesn't already have one
|
|
21
17
|
return link.substring(0, 1) === '/' ? link : "/".concat(link);
|
|
22
18
|
};
|
|
19
|
+
var getDomain = exports.getDomain = function getDomain(url) {
|
|
20
|
+
var thisURL = url;
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var getDomain = function getDomain(url) {
|
|
27
|
-
var thisURL = url; // Strip out protocol
|
|
28
|
-
|
|
29
|
-
thisURL = url.replace(/(https?:\/\/)?(www.)?/i, ''); // Strip out subdirectory/path
|
|
22
|
+
// Strip out protocol
|
|
23
|
+
thisURL = url.replace(/(https?:\/\/)?(www.)?/i, '');
|
|
30
24
|
|
|
25
|
+
// Strip out subdirectory/path
|
|
31
26
|
if (thisURL.indexOf('/') !== -1) {
|
|
32
27
|
var _thisURL$split = thisURL.split('/'),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
_thisURL$split2 = (0, _slicedToArray2.default)(_thisURL$split, 1),
|
|
29
|
+
splitURL = _thisURL$split2[0];
|
|
36
30
|
thisURL = splitURL;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
return thisURL;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.getDomain = getDomain;
|
|
33
|
+
};
|
package/dist/utils/navHelper.js
CHANGED
|
@@ -4,18 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/* Determine where to grab the URL, depending on the component type and values supplied */
|
|
9
8
|
var NavHelper = function NavHelper(navItem) {
|
|
10
9
|
/* Default url path location for 'Pages' */
|
|
11
10
|
var thisUrl = navItem.path;
|
|
12
|
-
|
|
13
11
|
if (navItem.internal.type === 'ContentfulComponentLink') {
|
|
14
12
|
thisUrl = navItem.reference && navItem.reference.path ? navItem.reference.path : navItem.url;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return thisUrl;
|
|
18
15
|
};
|
|
19
|
-
|
|
20
|
-
var _default = NavHelper;
|
|
21
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = NavHelper;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comicrelief/component-library",
|
|
3
3
|
"author": "Comic Relief Engineering Team",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.23.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"jest": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"react-hook-form": "^6.3.0",
|
|
38
38
|
"react-modal": "^3.16.1",
|
|
39
39
|
"react-responsive": "^9.0.2",
|
|
40
|
+
"react-range-slider-input": "^3.0.7",
|
|
40
41
|
"react-scripts": "4.0.3",
|
|
41
42
|
"react-spinners": "^0.11.0",
|
|
42
43
|
"react-styleguidist": "^11.1.7",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Promo
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const defaultData = require('../../../styleguide/data/data').defaultData;
|
|
4
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;
|
|
5
|
+
import Text from '../../Atoms/Text/Text';
|
|
5
6
|
import Link from '../../Atoms/Link/Link';
|
|
6
7
|
|
|
7
8
|
<div>
|
|
@@ -19,13 +19,15 @@ const PromoVideo = ({
|
|
|
19
19
|
const videoEl = useRef(null);
|
|
20
20
|
|
|
21
21
|
const togglePlay = () => {
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (videoEl.current) {
|
|
23
|
+
if (isPlaying) videoEl.current.pause();
|
|
24
|
+
else videoEl.current.play();
|
|
25
|
+
setIsPlaying(!isPlaying);
|
|
26
|
+
}
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
const updateTime = () => {
|
|
28
|
-
if (videoEl.current.duration) {
|
|
30
|
+
if (videoEl.current && videoEl.current.duration) {
|
|
29
31
|
// Calculate the percentage of the video played:
|
|
30
32
|
const percentage = Math.round((videoEl.current.currentTime / videoEl.current.duration) * 100);
|
|
31
33
|
// Because a completely smooth animation is impossible with the 250ms-ish frequency of
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Text from '../../Atoms/Text/Text';
|
|
3
|
+
|
|
4
|
+
const MoneybuyWrapper = styled.div`
|
|
5
|
+
margin-top: 32px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-content: space-between;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
align-items: stretch;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
const Moneybuy = styled.div`
|
|
20
|
+
display: inherit;
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding: 8px 20px;
|
|
23
|
+
height: auto;
|
|
24
|
+
background-color: white;
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
border: 1px solid ${props => props.theme.color('black')};;
|
|
27
|
+
position: relative;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: flex-start;
|
|
31
|
+
opacity: 1;
|
|
32
|
+
|
|
33
|
+
${props => props.isInactive && css`
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
`}
|
|
36
|
+
|
|
37
|
+
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
38
|
+
width: 70%;
|
|
39
|
+
padding: 8px 40px;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
44
|
+
padding: 20px 14px;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
width: 18%;
|
|
47
|
+
max-height: none;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const OrLabel = styled(Text)`
|
|
52
|
+
display: inherit;
|
|
53
|
+
align-items: center;
|
|
54
|
+
margin: 8px 0;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const MoneybuyImage = styled.span`
|
|
59
|
+
background: center / 65% no-repeat url("${props => props.imageURL}"),
|
|
60
|
+
${props => props.theme.color('grey_extra_light')};
|
|
61
|
+
width: 48px;
|
|
62
|
+
height: 48px;
|
|
63
|
+
border-radius: 48px;
|
|
64
|
+
|
|
65
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
66
|
+
width: 0;
|
|
67
|
+
height: 0;
|
|
68
|
+
padding: 30%;
|
|
69
|
+
border-radius: 100%;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const MoneybuyAmount = styled(Text)`
|
|
74
|
+
text-align: center;
|
|
75
|
+
margin: 0 10px;
|
|
76
|
+
width: 25%;
|
|
77
|
+
|
|
78
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
79
|
+
margin: 8px 15px 2px;
|
|
80
|
+
width: auto;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
const MoneybuyDescription = styled(Text)`
|
|
85
|
+
text-align: left;
|
|
86
|
+
width: 50%;
|
|
87
|
+
|
|
88
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
89
|
+
width: 100%;
|
|
90
|
+
text-align: center;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
MoneybuyWrapper, Moneybuy, OrLabel, MoneybuyImage, MoneybuyAmount, MoneybuyDescription
|
|
96
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Text from '../../Atoms/Text/Text';
|
|
4
|
+
import Slider from './_Slider';
|
|
5
|
+
import Moneybuys from './_ImpactMoneybuys';
|
|
6
|
+
import handleSubmission from './_utils';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
OuterWrapper, InnerWrapper, Copy, CurrentAmountCopy, SubmitButton
|
|
10
|
+
} from './ImpactSlider.style';
|
|
11
|
+
|
|
12
|
+
const ImpactSlider = ({
|
|
13
|
+
heading, cartID, donateLink, rowID, items, step,
|
|
14
|
+
max, opacityAnimation, children, defaultSliderValue
|
|
15
|
+
}) => {
|
|
16
|
+
// Use the lowest possible amount as our default:
|
|
17
|
+
const [currentAmount, setCurrentAmount] = useState(defaultSliderValue || step);
|
|
18
|
+
|
|
19
|
+
const handleChange = thisValue => {
|
|
20
|
+
if (thisValue) {
|
|
21
|
+
// Return the value of the 'thumb' we care about:
|
|
22
|
+
setCurrentAmount(thisValue[1]);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleSubmit = () => {
|
|
27
|
+
handleSubmission(currentAmount, donateLink, cartID, rowID);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<OuterWrapper>
|
|
32
|
+
<InnerWrapper>
|
|
33
|
+
<Text tag="h1" family="Anton" uppercase weight="normal" size="xl">{heading}</Text>
|
|
34
|
+
<Copy>
|
|
35
|
+
{children}
|
|
36
|
+
</Copy>
|
|
37
|
+
<CurrentAmountCopy tag="p" size="s">
|
|
38
|
+
A donation of
|
|
39
|
+
{' '}
|
|
40
|
+
£
|
|
41
|
+
{currentAmount}
|
|
42
|
+
{' '}
|
|
43
|
+
could help pay for:
|
|
44
|
+
</CurrentAmountCopy>
|
|
45
|
+
<Slider
|
|
46
|
+
currentAmount={currentAmount}
|
|
47
|
+
min={step}
|
|
48
|
+
max={max}
|
|
49
|
+
handleChange={handleChange}
|
|
50
|
+
steps={step}
|
|
51
|
+
/>
|
|
52
|
+
<Moneybuys
|
|
53
|
+
items={items}
|
|
54
|
+
currentAmount={currentAmount}
|
|
55
|
+
opacityAnimation={opacityAnimation}
|
|
56
|
+
/>
|
|
57
|
+
<SubmitButton type="submit" onClick={handleSubmit} disabled={currentAmount === 0}>
|
|
58
|
+
Donate £
|
|
59
|
+
{currentAmount}
|
|
60
|
+
{' '}
|
|
61
|
+
now
|
|
62
|
+
</SubmitButton>
|
|
63
|
+
</InnerWrapper>
|
|
64
|
+
</OuterWrapper>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
ImpactSlider.defaultProps = {
|
|
69
|
+
opacityAnimation: false,
|
|
70
|
+
defaultSliderValue: null
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
ImpactSlider.propTypes = {
|
|
74
|
+
heading: PropTypes.string.isRequired,
|
|
75
|
+
children: PropTypes.node.isRequired,
|
|
76
|
+
cartID: PropTypes.string.isRequired,
|
|
77
|
+
donateLink: PropTypes.string.isRequired,
|
|
78
|
+
rowID: PropTypes.string.isRequired,
|
|
79
|
+
step: PropTypes.number.isRequired,
|
|
80
|
+
max: PropTypes.number.isRequired,
|
|
81
|
+
defaultSliderValue: PropTypes.number,
|
|
82
|
+
opacityAnimation: PropTypes.bool,
|
|
83
|
+
items: PropTypes.arrayOf(
|
|
84
|
+
PropTypes.shape({
|
|
85
|
+
poundsPerItem: PropTypes.number.isRequired,
|
|
86
|
+
description: PropTypes.string.isRequired,
|
|
87
|
+
imageURL: PropTypes.string.isRequired
|
|
88
|
+
})
|
|
89
|
+
).isRequired
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default ImpactSlider;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Impact Slider (w/opacity animation)
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
const { testImpactSliderItems} = require('../../../styleguide/data/data');
|
|
5
|
+
import Text from '../../Atoms/Text/Text';
|
|
6
|
+
|
|
7
|
+
<ImpactSlider
|
|
8
|
+
heading="Your donations will change lives"
|
|
9
|
+
donateLink="https://donation-staging.spa.comicrelief.com"
|
|
10
|
+
rowID="to-come-from-the-cms"
|
|
11
|
+
cartID="to-also-come-from-the-cms"
|
|
12
|
+
items={testImpactSliderItems}
|
|
13
|
+
step={5}
|
|
14
|
+
max={100}
|
|
15
|
+
opacityAnimation={true}
|
|
16
|
+
>
|
|
17
|
+
<Text tag="p" color="black">
|
|
18
|
+
Use this slider to see how your donation can make a difference to lives in the UK and around the globe this winter.
|
|
19
|
+
</Text>
|
|
20
|
+
</ImpactSlider>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
# Impact Slider (w/o opacity animation, w/default value)
|
|
24
|
+
```js
|
|
25
|
+
const { testImpactSliderItems} = require('../../../styleguide/data/data');
|
|
26
|
+
import Text from '../../Atoms/Text/Text';
|
|
27
|
+
|
|
28
|
+
<ImpactSlider
|
|
29
|
+
heading="Your donations will change lives"
|
|
30
|
+
donateLink="https://donation-staging.spa.comicrelief.com"
|
|
31
|
+
rowID="to-come-from-the-cms"
|
|
32
|
+
cartID="to-also-come-from-the-cms"
|
|
33
|
+
items={testImpactSliderItems}
|
|
34
|
+
step={5}
|
|
35
|
+
max={100}
|
|
36
|
+
defaultSliderValue={45}
|
|
37
|
+
>
|
|
38
|
+
<Text tag="p" color="black">
|
|
39
|
+
Use this slider to see how your donation can make a difference to lives in the UK and around the globe this winter.
|
|
40
|
+
</Text>
|
|
41
|
+
</ImpactSlider>
|
|
42
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import Text from '../../Atoms/Text/Text';
|
|
3
|
+
import Button from '../../Atoms/Button/Button';
|
|
4
|
+
|
|
5
|
+
const OuterWrapper = styled.div`
|
|
6
|
+
position: relative;
|
|
7
|
+
margin: 0 auto;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
background-color: ${props => props.theme.color('grey_extra_light')};
|
|
10
|
+
padding: 32px 16px;
|
|
11
|
+
|
|
12
|
+
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
13
|
+
padding: 50px;
|
|
14
|
+
}
|
|
15
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
16
|
+
padding: 64px 0;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const InnerWrapper = styled.div`
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-width: 780px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
|
|
25
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
26
|
+
h1 {
|
|
27
|
+
font-size: 48px;
|
|
28
|
+
line-height: 48px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const Copy = styled.div`
|
|
34
|
+
position: relative;
|
|
35
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
36
|
+
p {
|
|
37
|
+
font-size: 20px;
|
|
38
|
+
line-height: 24.38px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const CurrentAmountCopy = styled(Text)`
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
margin-top: 16px;
|
|
46
|
+
|
|
47
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
48
|
+
font-size: 20px;
|
|
49
|
+
line-height: 24.38px;
|
|
50
|
+
margin: 24px 0 38px;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const SubmitButton = styled(Button)`
|
|
55
|
+
margin: 32px auto 0;
|
|
56
|
+
width: 100%;
|
|
57
|
+
font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
|
|
58
|
+
display: block;
|
|
59
|
+
|
|
60
|
+
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
61
|
+
width: 70%;
|
|
62
|
+
margin: 40px auto 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
OuterWrapper, Copy, CurrentAmountCopy, SubmitButton, InnerWrapper
|
|
72
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import RangeSlider from 'react-range-slider-input';
|
|
3
|
+
|
|
4
|
+
const thumbSize = 30;
|
|
5
|
+
const outlineSize = thumbSize / 2.5;
|
|
6
|
+
const sizeMultiplier = 1.4;
|
|
7
|
+
|
|
8
|
+
const StyledRangerSlider = styled(RangeSlider)`
|
|
9
|
+
background: white;
|
|
10
|
+
height: 16px;
|
|
11
|
+
border-radius: 16px;
|
|
12
|
+
border: 1px solid ${props => props.theme.color('black')};
|
|
13
|
+
|
|
14
|
+
.range-slider__range {
|
|
15
|
+
height: 14px;
|
|
16
|
+
border-radius: 10px;
|
|
17
|
+
background-color: ${props => props.theme.color('red')};
|
|
18
|
+
z-index: 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.range-slider__thumb[data-upper] {
|
|
22
|
+
&:after {
|
|
23
|
+
background-color: white;
|
|
24
|
+
width: ${thumbSize}px;
|
|
25
|
+
height: ${thumbSize}px;
|
|
26
|
+
content: "";
|
|
27
|
+
position: absolute;
|
|
28
|
+
transform: translate(-50%, -50%);
|
|
29
|
+
top: 50%;
|
|
30
|
+
left: 50%;
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
border: ${outlineSize}px solid ${props => props.theme.color('red')};
|
|
33
|
+
transition-property: width, height, border-width;
|
|
34
|
+
transition-duration: 0.15s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
&:after {
|
|
39
|
+
width: ${thumbSize * sizeMultiplier}px;
|
|
40
|
+
height: ${thumbSize * sizeMultiplier}px;
|
|
41
|
+
border-width: ${outlineSize}px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Hide other slider thumb, as per example from the docs
|
|
47
|
+
.range-slider__thumb[data-lower] {
|
|
48
|
+
width: 0;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const SliderWrapper = styled.div`
|
|
53
|
+
width: 100%;
|
|
54
|
+
margin-top: 25px;
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const SliderLabel = styled.label`
|
|
58
|
+
border: 0;
|
|
59
|
+
clip: rect(0 0 0 0);
|
|
60
|
+
height: 1px;
|
|
61
|
+
margin: -1px;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
padding: 0;
|
|
64
|
+
position: absolute;
|
|
65
|
+
width: 1px;
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
StyledRangerSlider, SliderWrapper, SliderLabel
|
|
70
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
MoneybuyWrapper, Moneybuy, OrLabel, MoneybuyImage, MoneybuyAmount, MoneybuyDescription
|
|
6
|
+
} from './ImpactMoneybuys.style';
|
|
7
|
+
|
|
8
|
+
const Moneybuys = ({ items, currentAmount, opacityAnimation }) => (
|
|
9
|
+
<MoneybuyWrapper>
|
|
10
|
+
{items.map((item, index) => {
|
|
11
|
+
const roundedPerPound = Math.floor(item.poundsPerItem);
|
|
12
|
+
const thisAmount = Math.floor(currentAmount / roundedPerPound);
|
|
13
|
+
const isInactive = !(!opacityAnimation || currentAmount >= roundedPerPound);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Fragment key={roundedPerPound}>
|
|
17
|
+
<Moneybuy isInactive={isInactive} data-testid={`impact-slider--moneybuy-${index + 1}`}>
|
|
18
|
+
<MoneybuyImage imageURL={item.imageURL} />
|
|
19
|
+
<MoneybuyAmount tag="p" family="Anton" uppercase weight="normal" size="xl" data-testid="moneybuy-amount">{thisAmount}</MoneybuyAmount>
|
|
20
|
+
<MoneybuyDescription tag="p" size="sm" data-testid="moneybuy-description">{item.description}</MoneybuyDescription>
|
|
21
|
+
</Moneybuy>
|
|
22
|
+
{ index < (items.length - 1) && (
|
|
23
|
+
<OrLabel tag="span">Or</OrLabel>
|
|
24
|
+
)}
|
|
25
|
+
</Fragment>
|
|
26
|
+
);
|
|
27
|
+
})}
|
|
28
|
+
</MoneybuyWrapper>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
Moneybuys.propTypes = {
|
|
32
|
+
items: PropTypes.arrayOf(
|
|
33
|
+
PropTypes.shape({
|
|
34
|
+
poundsPerItem: PropTypes.number.isRequired,
|
|
35
|
+
description: PropTypes.string.isRequired,
|
|
36
|
+
imageURL: PropTypes.string.isRequired
|
|
37
|
+
})
|
|
38
|
+
).isRequired,
|
|
39
|
+
currentAmount: PropTypes.number.isRequired,
|
|
40
|
+
opacityAnimation: PropTypes.bool.isRequired
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Moneybuys;
|