@comicrelief/component-library 8.83.1 → 8.84.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/index.cjs.js +1227 -859
- package/dist/index.es.js +10902 -10144
- package/package.json +1 -1
- package/src/App.styles.js +2 -2
- package/src/components/Atoms/Button/Button.js +13 -3
- package/src/components/Atoms/Button/Button.style.js +19 -1
- package/src/components/Atoms/Button/Button.test.js +1 -1
- package/src/components/Atoms/Button/ButtonExample.jsx +24 -0
- package/src/components/Atoms/ButtonWithStates/ButtonWithStates.js +1 -1
- package/src/components/Atoms/Icons/Cross.js +0 -1
- package/src/components/Atoms/Icons/Download.js +4 -4
- package/src/components/Atoms/Icons/External.js +4 -4
- package/src/components/Atoms/Icons/Filter.js +50 -0
- package/src/components/Atoms/Icons/IconsExample.jsx +9 -5
- package/src/components/Atoms/Icons/Undo.js +44 -0
- package/src/components/Atoms/Icons/index.js +2 -0
- package/src/components/Atoms/Link/Link.test.js +1 -1
- package/src/components/Atoms/Link/LinkExample.jsx +4 -2
- package/src/components/Atoms/Text/TextExample.jsx +338 -130
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +2 -2
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +2 -2
- package/src/components/Molecules/QuoteSlice/__snapshots__/QuoteSlice.test.js.snap +1 -1
- package/src/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +2 -2
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +1 -3
- package/src/components/Organisms/CookieBanner/CookieBanner.test.js +1 -1
- package/src/components/Organisms/EmailBanner/__snapshots__/EmailBanner.test.js.snap +12 -12
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +3 -3
- package/src/components/Organisms/FilterCard/FilterCard.js +286 -0
- package/src/components/Organisms/FilterCard/FilterCard.style.js +425 -0
- package/src/components/Organisms/FilterCard/FilterCard.test.js +60 -0
- package/src/components/Organisms/FilterCard/FilterCardExample.jsx +48 -0
- package/src/components/Organisms/FilterCard/FilterCardNodes.js +155 -0
- package/src/components/Organisms/FilterCard/__snapshots__/FilterCard.test.js.snap +1006 -0
- package/src/components/Organisms/FilterCard/_utils/_utils.js +57 -0
- package/src/components/Organisms/FilterCard/assets/Rectangle.svg +3 -0
- package/src/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +4 -4
- package/src/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +1 -1
- package/src/data/TestFilterCardNodeData.js +930 -0
- package/src/data/data.js +64 -1
- package/src/data/test-icons/Children--black.svg +5 -0
- package/src/data/test-icons/Children--white.svg +5 -0
- package/src/demos/index.jsx +31 -9
- package/src/index.js +1 -0
- package/src/theme/crTheme/buttonColors.js +3 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Download, External } from '../../../Atoms/Icons/index';
|
|
3
|
+
|
|
4
|
+
const preprocessNodes = nodesToProcess => {
|
|
5
|
+
const outputNodes = [];
|
|
6
|
+
const outputTags = {};
|
|
7
|
+
|
|
8
|
+
nodesToProcess.forEach((thisNode, index) => {
|
|
9
|
+
// Copy over this entire node:
|
|
10
|
+
outputNodes[index] = { ...thisNode };
|
|
11
|
+
|
|
12
|
+
// Create a way simplier, non-nested representation of the nested 'FilterTag' content:
|
|
13
|
+
outputNodes[index].tags = thisNode.filterTags.map(thisTag => {
|
|
14
|
+
// But, while we're here, first keep a dedicated array of *every* tags we've seen:
|
|
15
|
+
outputTags[thisTag.title] = {
|
|
16
|
+
tag: thisTag?.tag,
|
|
17
|
+
selectedIcon: thisTag?.filterIconSelected?.file?.url,
|
|
18
|
+
unselectedIcon: thisTag?.filterIconUnselected?.file?.url
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return thisTag.tag;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Finally, remove the obtuse Contentful object we no longer need:
|
|
25
|
+
delete outputNodes[index].filterTags;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return { outputNodes, outputTags };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getIcon = whichIcon => {
|
|
32
|
+
switch (whichIcon) {
|
|
33
|
+
case 'Download':
|
|
34
|
+
return <Download colour="black" size={20} />;
|
|
35
|
+
case 'External URL':
|
|
36
|
+
return <External colour="black" size={20} />;
|
|
37
|
+
case 'None':
|
|
38
|
+
default:
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Over-engineered to allow us to easily add more options in the future:
|
|
44
|
+
const renderNodeLimit = (optionLabel, hasHero) => {
|
|
45
|
+
switch (optionLabel) {
|
|
46
|
+
case 'Load 6 cards at a time + Hero Node (if set)':
|
|
47
|
+
// Factor in any Hero node which would result in an uneven grid:
|
|
48
|
+
return (hasHero ? 7 : 6);
|
|
49
|
+
case 'Load all cards at once':
|
|
50
|
+
default:
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
preprocessNodes, getIcon, renderNodeLimit
|
|
57
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="47" height="41" viewBox="0 0 47 41" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M17.726 2.34314C20.8501 -0.781058 25.9155 -0.781061 29.0397 2.34313L46.7646 20.0681L29.0397 37.7931C25.9155 40.9173 20.8502 40.9173 17.726 37.7931L0.000976755 20.0681L17.726 2.34314Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -46,7 +46,7 @@ exports[`does not render copyright text when not supplied 1`] = `
|
|
|
46
46
|
|
|
47
47
|
.c23:disabled {
|
|
48
48
|
cursor: not-allowed;
|
|
49
|
-
opacity: 0.
|
|
49
|
+
opacity: 0.35;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.c17 {
|
|
@@ -961,7 +961,7 @@ exports[`does not render copyright text when not supplied 1`] = `
|
|
|
961
961
|
>
|
|
962
962
|
<button
|
|
963
963
|
className="c23 c24"
|
|
964
|
-
data-testid="
|
|
964
|
+
data-testid="EmailSignUpButton"
|
|
965
965
|
type="submit"
|
|
966
966
|
>
|
|
967
967
|
<span
|
|
@@ -1386,7 +1386,7 @@ exports[`renders correctly 1`] = `
|
|
|
1386
1386
|
|
|
1387
1387
|
.c23:disabled {
|
|
1388
1388
|
cursor: not-allowed;
|
|
1389
|
-
opacity: 0.
|
|
1389
|
+
opacity: 0.35;
|
|
1390
1390
|
}
|
|
1391
1391
|
|
|
1392
1392
|
.c17 {
|
|
@@ -2301,7 +2301,7 @@ exports[`renders correctly 1`] = `
|
|
|
2301
2301
|
>
|
|
2302
2302
|
<button
|
|
2303
2303
|
className="c23 c24"
|
|
2304
|
-
data-testid="
|
|
2304
|
+
data-testid="EmailSignUpButton"
|
|
2305
2305
|
type="submit"
|
|
2306
2306
|
>
|
|
2307
2307
|
<span
|