@comicrelief/component-library 8.77.3 → 8.77.4
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 +998 -1081
- package/dist/index.es.js +14154 -15016
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Organisms/RichtextCarousel/RichtextCarousel.js +43 -76
- package/src/components/Organisms/RichtextCarousel/RichtextCarousel.style.js +88 -157
- package/src/components/Organisms/RichtextCarousel/RichtextCarousel.test.js +167 -382
- package/src/components/Organisms/RichtextCarousel/RichtextCarouselExample.jsx +2 -2
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.js +29 -5
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.style.js +0 -13
- package/src/components/Organisms/WYMDCarousel/WYMDCarouselExample.jsx +2 -1
- package/src/components/Organisms/WYMDCarousel/__snapshots__/WYMDCarousel.test.js.snap +38 -22
- package/src/data/data.js +3 -2
|
@@ -7,12 +7,12 @@ export default function RichtextCarouselExample() {
|
|
|
7
7
|
return (
|
|
8
8
|
<>
|
|
9
9
|
<ExampleContainer>
|
|
10
|
-
<h2 style={{ textAlign: 'center' }}>Richtext Carousel #1 (default padding)</h2>
|
|
10
|
+
<h2 style={{ textAlign: 'center' }}>Richtext Carousel #1 (default padding, autoplay off)</h2>
|
|
11
11
|
<RichtextCarousel data={RichtextCarouselItems} />
|
|
12
12
|
</ExampleContainer>
|
|
13
13
|
|
|
14
14
|
<ExampleContainer>
|
|
15
|
-
<h2 style={{ textAlign: 'center' }}>Richtext Carousel #2 (custom padding)</h2>
|
|
15
|
+
<h2 style={{ textAlign: 'center' }}>Richtext Carousel #2 (custom padding, autoplay on)</h2>
|
|
16
16
|
<RichtextCarousel data={RichtextCarouselItemsWithPadding} />
|
|
17
17
|
</ExampleContainer>
|
|
18
18
|
</>
|
|
@@ -39,6 +39,7 @@ const WYMDCarousel = ({ data }) => {
|
|
|
39
39
|
$paddingTop={paddingTop}
|
|
40
40
|
$paddingBottom={paddingBottom}
|
|
41
41
|
$backgroundColour={backgroundColour}
|
|
42
|
+
data-testid="wymd-carousel--container"
|
|
42
43
|
>
|
|
43
44
|
|
|
44
45
|
<CarouselWrapper
|
|
@@ -47,22 +48,37 @@ const WYMDCarousel = ({ data }) => {
|
|
|
47
48
|
$mobileHeight={mobileHeight}
|
|
48
49
|
$tabletHeight={tabletHeight}
|
|
49
50
|
$desktopHeight={desktopHeight}
|
|
51
|
+
data-testid="wymd-carousel--wrapper"
|
|
50
52
|
>
|
|
51
|
-
<Heading
|
|
53
|
+
<Heading
|
|
54
|
+
tag="p"
|
|
55
|
+
weight="bold"
|
|
56
|
+
data-testid="wymd-carousel--heading"
|
|
57
|
+
>
|
|
52
58
|
{ headerCopy}
|
|
53
59
|
</Heading>
|
|
54
60
|
|
|
55
|
-
<PeopleHelpedText
|
|
61
|
+
<PeopleHelpedText
|
|
62
|
+
tag="h1"
|
|
63
|
+
family="Anton"
|
|
64
|
+
weight="normal"
|
|
65
|
+
color="red"
|
|
66
|
+
data-testid="wymd-carousel--people-helped"
|
|
67
|
+
>
|
|
56
68
|
{ peopleHelpedText}
|
|
57
69
|
</PeopleHelpedText>
|
|
58
70
|
|
|
59
|
-
<Including
|
|
71
|
+
<Including
|
|
72
|
+
tag="p"
|
|
73
|
+
data-testid="wymd-carousel--including"
|
|
74
|
+
>
|
|
60
75
|
including...
|
|
61
76
|
</Including>
|
|
62
77
|
|
|
63
78
|
{theseItems && (
|
|
64
79
|
<Splide
|
|
65
80
|
className="wymd-carousel"
|
|
81
|
+
data-testid="wymd-carousel--splide"
|
|
66
82
|
options={{
|
|
67
83
|
speed: 750,
|
|
68
84
|
rewindSpeed: 750,
|
|
@@ -97,6 +113,7 @@ const WYMDCarousel = ({ data }) => {
|
|
|
97
113
|
key={safeIndex}
|
|
98
114
|
index={safeIndex}
|
|
99
115
|
data-index={safeIndex}
|
|
116
|
+
data-testid="wymd-carousel--slide"
|
|
100
117
|
>
|
|
101
118
|
<SlideInner>
|
|
102
119
|
<ImageWrapper className="image-wrapper">
|
|
@@ -105,13 +122,20 @@ const WYMDCarousel = ({ data }) => {
|
|
|
105
122
|
|
|
106
123
|
<AllTextWrapper>
|
|
107
124
|
<AmountWrapper>
|
|
108
|
-
<Text
|
|
125
|
+
<Text
|
|
126
|
+
tag="h1"
|
|
127
|
+
family="Anton"
|
|
128
|
+
data-testid="wymd-carousel--amount"
|
|
129
|
+
>
|
|
109
130
|
{theseItems[key].amount}
|
|
110
131
|
</Text>
|
|
111
132
|
</AmountWrapper>
|
|
112
133
|
|
|
113
134
|
<CopyWrapper>
|
|
114
|
-
<Text
|
|
135
|
+
<Text
|
|
136
|
+
tag="p"
|
|
137
|
+
data-testid="wymd-carousel--copy"
|
|
138
|
+
>
|
|
115
139
|
{theseItems[key].copy}
|
|
116
140
|
</Text>
|
|
117
141
|
</CopyWrapper>
|
|
@@ -211,19 +211,6 @@ const CarouselWrapper = styled.div`
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
// Reorientate for the right-side 'next' button
|
|
215
|
-
button.carousel__next-button {
|
|
216
|
-
left: auto;
|
|
217
|
-
right: 0;
|
|
218
|
-
|
|
219
|
-
&:after {
|
|
220
|
-
left: auto;
|
|
221
|
-
right: 0;
|
|
222
|
-
background: linear-gradient(270deg, rgba(255, 255, 255, 1),
|
|
223
|
-
rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
214
|
// Carousel:
|
|
228
215
|
&.wymd-carousel {
|
|
229
216
|
.splide__slide {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import WYMDCarousel from './WYMDCarousel';
|
|
3
3
|
import {
|
|
4
|
-
carouselItemsComplete, carouselItemsCompleteWithPadding,
|
|
4
|
+
carouselItemsComplete, carouselItemsCompleteWithPadding,
|
|
5
|
+
carouselItemsIncomplete, carouselItemsMinimal
|
|
5
6
|
} from '../../../data/data';
|
|
6
7
|
import { ExampleContainer } from '../../../demos/SharedStyles';
|
|
7
8
|
|
|
@@ -553,17 +553,6 @@ exports[`renders the customised padding version correctly:
|
|
|
553
553
|
display: none;
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
-
.c1 .splide button.carousel__next-button {
|
|
557
|
-
left: auto;
|
|
558
|
-
right: 0;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
.c1 .splide button.carousel__next-button:after {
|
|
562
|
-
left: auto;
|
|
563
|
-
right: 0;
|
|
564
|
-
background: linear-gradient(270deg,rgba(255,255,255,1),rgba(255,255,255,0.5),rgba(255,255,255,0));
|
|
565
|
-
}
|
|
566
|
-
|
|
567
556
|
.c1 .splide.wymd-carousel .splide__slide {
|
|
568
557
|
height: 425px;
|
|
569
558
|
}
|
|
@@ -706,28 +695,34 @@ exports[`renders the customised padding version correctly:
|
|
|
706
695
|
|
|
707
696
|
<div
|
|
708
697
|
className="c0"
|
|
698
|
+
data-testid="wymd-carousel--container"
|
|
709
699
|
>
|
|
710
700
|
<div
|
|
711
701
|
className="c1 CarouselWrapper"
|
|
702
|
+
data-testid="wymd-carousel--wrapper"
|
|
712
703
|
id="7zdR84QkZwrTh9NWx2H926"
|
|
713
704
|
>
|
|
714
705
|
<p
|
|
715
706
|
className="c2 c3"
|
|
707
|
+
data-testid="wymd-carousel--heading"
|
|
716
708
|
>
|
|
717
709
|
Over the past two years, we've supported
|
|
718
710
|
</p>
|
|
719
711
|
<h1
|
|
720
712
|
className="c4 c5"
|
|
713
|
+
data-testid="wymd-carousel--people-helped"
|
|
721
714
|
>
|
|
722
715
|
11.7 million people
|
|
723
716
|
</h1>
|
|
724
717
|
<p
|
|
725
718
|
className="c6 c7"
|
|
719
|
+
data-testid="wymd-carousel--including"
|
|
726
720
|
>
|
|
727
721
|
including...
|
|
728
722
|
</p>
|
|
729
723
|
<div
|
|
730
724
|
className="splide wymd-carousel"
|
|
725
|
+
data-testid="wymd-carousel--splide"
|
|
731
726
|
>
|
|
732
727
|
<div
|
|
733
728
|
className="splide__track"
|
|
@@ -738,6 +733,7 @@ exports[`renders the customised padding version correctly:
|
|
|
738
733
|
<li
|
|
739
734
|
className="splide__slide"
|
|
740
735
|
data-index={0}
|
|
736
|
+
data-testid="wymd-carousel--slide"
|
|
741
737
|
index={0}
|
|
742
738
|
>
|
|
743
739
|
<div
|
|
@@ -759,6 +755,7 @@ exports[`renders the customised padding version correctly:
|
|
|
759
755
|
>
|
|
760
756
|
<h1
|
|
761
757
|
className="c11"
|
|
758
|
+
data-testid="wymd-carousel--amount"
|
|
762
759
|
>
|
|
763
760
|
1,000
|
|
764
761
|
</h1>
|
|
@@ -768,6 +765,7 @@ exports[`renders the customised padding version correctly:
|
|
|
768
765
|
>
|
|
769
766
|
<p
|
|
770
767
|
className="c6"
|
|
768
|
+
data-testid="wymd-carousel--copy"
|
|
771
769
|
>
|
|
772
770
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
773
771
|
</p>
|
|
@@ -778,6 +776,7 @@ exports[`renders the customised padding version correctly:
|
|
|
778
776
|
<li
|
|
779
777
|
className="splide__slide"
|
|
780
778
|
data-index={1}
|
|
779
|
+
data-testid="wymd-carousel--slide"
|
|
781
780
|
index={1}
|
|
782
781
|
>
|
|
783
782
|
<div
|
|
@@ -799,6 +798,7 @@ exports[`renders the customised padding version correctly:
|
|
|
799
798
|
>
|
|
800
799
|
<h1
|
|
801
800
|
className="c11"
|
|
801
|
+
data-testid="wymd-carousel--amount"
|
|
802
802
|
>
|
|
803
803
|
750,000
|
|
804
804
|
</h1>
|
|
@@ -808,6 +808,7 @@ exports[`renders the customised padding version correctly:
|
|
|
808
808
|
>
|
|
809
809
|
<p
|
|
810
810
|
className="c6"
|
|
811
|
+
data-testid="wymd-carousel--copy"
|
|
811
812
|
>
|
|
812
813
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
813
814
|
</p>
|
|
@@ -818,6 +819,7 @@ exports[`renders the customised padding version correctly:
|
|
|
818
819
|
<li
|
|
819
820
|
className="splide__slide"
|
|
820
821
|
data-index={2}
|
|
822
|
+
data-testid="wymd-carousel--slide"
|
|
821
823
|
index={2}
|
|
822
824
|
>
|
|
823
825
|
<div
|
|
@@ -839,6 +841,7 @@ exports[`renders the customised padding version correctly:
|
|
|
839
841
|
>
|
|
840
842
|
<h1
|
|
841
843
|
className="c11"
|
|
844
|
+
data-testid="wymd-carousel--amount"
|
|
842
845
|
>
|
|
843
846
|
3,000
|
|
844
847
|
</h1>
|
|
@@ -848,6 +851,7 @@ exports[`renders the customised padding version correctly:
|
|
|
848
851
|
>
|
|
849
852
|
<p
|
|
850
853
|
className="c6"
|
|
854
|
+
data-testid="wymd-carousel--copy"
|
|
851
855
|
>
|
|
852
856
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
853
857
|
</p>
|
|
@@ -858,6 +862,7 @@ exports[`renders the customised padding version correctly:
|
|
|
858
862
|
<li
|
|
859
863
|
className="splide__slide"
|
|
860
864
|
data-index={3}
|
|
865
|
+
data-testid="wymd-carousel--slide"
|
|
861
866
|
index={3}
|
|
862
867
|
>
|
|
863
868
|
<div
|
|
@@ -879,6 +884,7 @@ exports[`renders the customised padding version correctly:
|
|
|
879
884
|
>
|
|
880
885
|
<h1
|
|
881
886
|
className="c11"
|
|
887
|
+
data-testid="wymd-carousel--amount"
|
|
882
888
|
>
|
|
883
889
|
4,000
|
|
884
890
|
</h1>
|
|
@@ -888,6 +894,7 @@ exports[`renders the customised padding version correctly:
|
|
|
888
894
|
>
|
|
889
895
|
<p
|
|
890
896
|
className="c6"
|
|
897
|
+
data-testid="wymd-carousel--copy"
|
|
891
898
|
>
|
|
892
899
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
893
900
|
</p>
|
|
@@ -898,6 +905,7 @@ exports[`renders the customised padding version correctly:
|
|
|
898
905
|
<li
|
|
899
906
|
className="splide__slide"
|
|
900
907
|
data-index={4}
|
|
908
|
+
data-testid="wymd-carousel--slide"
|
|
901
909
|
index={4}
|
|
902
910
|
>
|
|
903
911
|
<div
|
|
@@ -919,6 +927,7 @@ exports[`renders the customised padding version correctly:
|
|
|
919
927
|
>
|
|
920
928
|
<h1
|
|
921
929
|
className="c11"
|
|
930
|
+
data-testid="wymd-carousel--amount"
|
|
922
931
|
>
|
|
923
932
|
5,000
|
|
924
933
|
</h1>
|
|
@@ -928,6 +937,7 @@ exports[`renders the customised padding version correctly:
|
|
|
928
937
|
>
|
|
929
938
|
<p
|
|
930
939
|
className="c6"
|
|
940
|
+
data-testid="wymd-carousel--copy"
|
|
931
941
|
>
|
|
932
942
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
933
943
|
</p>
|
|
@@ -938,6 +948,7 @@ exports[`renders the customised padding version correctly:
|
|
|
938
948
|
<li
|
|
939
949
|
className="splide__slide"
|
|
940
950
|
data-index={5}
|
|
951
|
+
data-testid="wymd-carousel--slide"
|
|
941
952
|
index={5}
|
|
942
953
|
>
|
|
943
954
|
<div
|
|
@@ -959,6 +970,7 @@ exports[`renders the customised padding version correctly:
|
|
|
959
970
|
>
|
|
960
971
|
<h1
|
|
961
972
|
className="c11"
|
|
973
|
+
data-testid="wymd-carousel--amount"
|
|
962
974
|
>
|
|
963
975
|
6,000
|
|
964
976
|
</h1>
|
|
@@ -968,6 +980,7 @@ exports[`renders the customised padding version correctly:
|
|
|
968
980
|
>
|
|
969
981
|
<p
|
|
970
982
|
className="c6"
|
|
983
|
+
data-testid="wymd-carousel--copy"
|
|
971
984
|
>
|
|
972
985
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
973
986
|
</p>
|
|
@@ -978,6 +991,7 @@ exports[`renders the customised padding version correctly:
|
|
|
978
991
|
<li
|
|
979
992
|
className="splide__slide"
|
|
980
993
|
data-index={6}
|
|
994
|
+
data-testid="wymd-carousel--slide"
|
|
981
995
|
index={6}
|
|
982
996
|
>
|
|
983
997
|
<div
|
|
@@ -999,6 +1013,7 @@ exports[`renders the customised padding version correctly:
|
|
|
999
1013
|
>
|
|
1000
1014
|
<h1
|
|
1001
1015
|
className="c11"
|
|
1016
|
+
data-testid="wymd-carousel--amount"
|
|
1002
1017
|
>
|
|
1003
1018
|
7,000
|
|
1004
1019
|
</h1>
|
|
@@ -1008,6 +1023,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1008
1023
|
>
|
|
1009
1024
|
<p
|
|
1010
1025
|
className="c6"
|
|
1026
|
+
data-testid="wymd-carousel--copy"
|
|
1011
1027
|
>
|
|
1012
1028
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
1013
1029
|
</p>
|
|
@@ -1018,6 +1034,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1018
1034
|
<li
|
|
1019
1035
|
className="splide__slide"
|
|
1020
1036
|
data-index={7}
|
|
1037
|
+
data-testid="wymd-carousel--slide"
|
|
1021
1038
|
index={7}
|
|
1022
1039
|
>
|
|
1023
1040
|
<div
|
|
@@ -1039,6 +1056,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1039
1056
|
>
|
|
1040
1057
|
<h1
|
|
1041
1058
|
className="c11"
|
|
1059
|
+
data-testid="wymd-carousel--amount"
|
|
1042
1060
|
>
|
|
1043
1061
|
8,000
|
|
1044
1062
|
</h1>
|
|
@@ -1048,6 +1066,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1048
1066
|
>
|
|
1049
1067
|
<p
|
|
1050
1068
|
className="c6"
|
|
1069
|
+
data-testid="wymd-carousel--copy"
|
|
1051
1070
|
>
|
|
1052
1071
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
1053
1072
|
</p>
|
|
@@ -1058,6 +1077,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1058
1077
|
<li
|
|
1059
1078
|
className="splide__slide last-slide"
|
|
1060
1079
|
data-index={8}
|
|
1080
|
+
data-testid="wymd-carousel--slide"
|
|
1061
1081
|
index={8}
|
|
1062
1082
|
>
|
|
1063
1083
|
<div
|
|
@@ -1079,6 +1099,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1079
1099
|
>
|
|
1080
1100
|
<h1
|
|
1081
1101
|
className="c11"
|
|
1102
|
+
data-testid="wymd-carousel--amount"
|
|
1082
1103
|
>
|
|
1083
1104
|
9,000
|
|
1084
1105
|
</h1>
|
|
@@ -1088,6 +1109,7 @@ exports[`renders the customised padding version correctly:
|
|
|
1088
1109
|
>
|
|
1089
1110
|
<p
|
|
1090
1111
|
className="c6"
|
|
1112
|
+
data-testid="wymd-carousel--copy"
|
|
1091
1113
|
>
|
|
1092
1114
|
children and young people in the UK and around the world, including with safe homes, good nutrition and access to quality healthcare and education.
|
|
1093
1115
|
</p>
|
|
@@ -1591,17 +1613,6 @@ exports[`renders the default padding version correctly:
|
|
|
1591
1613
|
display: none;
|
|
1592
1614
|
}
|
|
1593
1615
|
|
|
1594
|
-
.c1 .splide button.carousel__next-button {
|
|
1595
|
-
left: auto;
|
|
1596
|
-
right: 0;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
.c1 .splide button.carousel__next-button:after {
|
|
1600
|
-
left: auto;
|
|
1601
|
-
right: 0;
|
|
1602
|
-
background: linear-gradient(270deg,rgba(255,255,255,1),rgba(255,255,255,0.5),rgba(255,255,255,0));
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
1616
|
.c1 .splide.wymd-carousel .splide__slide {
|
|
1606
1617
|
height: 425px;
|
|
1607
1618
|
}
|
|
@@ -1707,23 +1718,28 @@ exports[`renders the default padding version correctly:
|
|
|
1707
1718
|
|
|
1708
1719
|
<div
|
|
1709
1720
|
className="c0"
|
|
1721
|
+
data-testid="wymd-carousel--container"
|
|
1710
1722
|
>
|
|
1711
1723
|
<div
|
|
1712
1724
|
className="c1 CarouselWrapper"
|
|
1725
|
+
data-testid="wymd-carousel--wrapper"
|
|
1713
1726
|
id="7zdR84QkZwrTh9NWx2H926"
|
|
1714
1727
|
>
|
|
1715
1728
|
<p
|
|
1716
1729
|
className="c2 c3"
|
|
1730
|
+
data-testid="wymd-carousel--heading"
|
|
1717
1731
|
>
|
|
1718
1732
|
Over the past two years, we've supported
|
|
1719
1733
|
</p>
|
|
1720
1734
|
<h1
|
|
1721
1735
|
className="c4 c5"
|
|
1736
|
+
data-testid="wymd-carousel--people-helped"
|
|
1722
1737
|
>
|
|
1723
1738
|
11.7 million people
|
|
1724
1739
|
</h1>
|
|
1725
1740
|
<p
|
|
1726
1741
|
className="c6 c7"
|
|
1742
|
+
data-testid="wymd-carousel--including"
|
|
1727
1743
|
>
|
|
1728
1744
|
including...
|
|
1729
1745
|
</p>
|
package/src/data/data.js
CHANGED
|
@@ -323,7 +323,7 @@ const RichtextCarouselItems = {
|
|
|
323
323
|
{ copy: 'Some other longside but not really all that long copy, who knows, it could be this long or LESS' },
|
|
324
324
|
{ copy: '140 character count limit imposed in messages to fix the design height of each container and restrict anomalies. This is based on Twitters character limit for tweets. ABIGLONGLINETOFORCEONTOANEWONE' }
|
|
325
325
|
],
|
|
326
|
-
autoPlay:
|
|
326
|
+
autoPlay: false
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
const RichtextCarouselItemsWithPadding = {
|
|
@@ -338,7 +338,8 @@ const RichtextCarouselItemsWithPadding = {
|
|
|
338
338
|
autoPlay: true,
|
|
339
339
|
paddingBottom: '4rem',
|
|
340
340
|
paddingTop: '4rem',
|
|
341
|
-
rowBackgroundColour: 'teal_light'
|
|
341
|
+
rowBackgroundColour: 'teal_light',
|
|
342
|
+
carouselBackgroundColour: 'grey_light'
|
|
342
343
|
};
|
|
343
344
|
|
|
344
345
|
export {
|