@comicrelief/component-library 7.34.0 → 7.35.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/Accordion/Accordion.js +1 -1
- package/dist/components/Molecules/Accordion/__snapshots__/Accordion.test.js.snap +1 -0
- package/dist/components/Organisms/WYMDCarousel/WYMDCarousel.js +121 -0
- package/dist/components/Organisms/WYMDCarousel/WYMDCarousel.md +40 -0
- package/dist/components/Organisms/WYMDCarousel/WYMDCarousel.style.js +82 -0
- package/dist/components/Organisms/WYMDCarousel/WYMDCarousel.test.js +16 -0
- package/dist/components/Organisms/WYMDCarousel/_utils.js +43 -0
- package/dist/styleguide/data/data.js +212 -2
- package/package.json +3 -2
- package/src/components/Molecules/Accordion/Accordion.js +1 -0
- package/src/components/Molecules/Accordion/__snapshots__/Accordion.test.js.snap +1 -0
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.js +238 -0
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.md +40 -0
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.style.js +278 -0
- package/src/components/Organisms/WYMDCarousel/WYMDCarousel.test.js +317 -0
- package/src/components/Organisms/WYMDCarousel/_utils.js +41 -0
- package/src/styleguide/data/data.js +215 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useEffect, useState, useCallback
|
|
3
|
+
} from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import {
|
|
6
|
+
CarouselProvider, Slider, Slide, ButtonBack, ButtonNext
|
|
7
|
+
} from 'pure-react-carousel';
|
|
8
|
+
import formatItems from './_utils';
|
|
9
|
+
import 'pure-react-carousel/dist/react-carousel.es.css';
|
|
10
|
+
import {
|
|
11
|
+
CarouselWrapper, ImageWrapper, AmountWrapper, CopyWrapper, Heading, PeopleHelpedText, Including
|
|
12
|
+
} from './WYMDCarousel.style';
|
|
13
|
+
import Text from '../../Atoms/Text/Text';
|
|
14
|
+
import { sizes } from '../../../theme/shared/breakpoint';
|
|
15
|
+
|
|
16
|
+
const WYMDCarousel = ({ data, data: { autoPlay, contentful_id: thisID } }) => {
|
|
17
|
+
// Defaults to mobile config:
|
|
18
|
+
const [isMobileOrTablet, setIsMobileOrTablet] = useState(true);
|
|
19
|
+
const [visibleSlides, setVisibleSlides] = useState(1);
|
|
20
|
+
const [totalSlides, setTotalSlides] = useState(null);
|
|
21
|
+
const [theseItems, setTheseItems] = useState();
|
|
22
|
+
|
|
23
|
+
// Custom function to let us update the carousel config dynamically
|
|
24
|
+
const screenResize = useCallback(() => {
|
|
25
|
+
const screenSize = typeof window !== 'undefined' ? window.innerWidth : null;
|
|
26
|
+
const isCurrentlyMobile = window.innerWidth < sizes.medium;
|
|
27
|
+
|
|
28
|
+
if (screenSize !== null && (isMobileOrTablet !== isCurrentlyMobile)) {
|
|
29
|
+
setIsMobileOrTablet(isCurrentlyMobile);
|
|
30
|
+
setVisibleSlides(isCurrentlyMobile ? 1 : 3);
|
|
31
|
+
setTotalSlides(isCurrentlyMobile ? theseItems.length : theseItems.length + 2);
|
|
32
|
+
}
|
|
33
|
+
}, [isMobileOrTablet, theseItems]);
|
|
34
|
+
|
|
35
|
+
// Format our data BEFORE we use it in render:
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setTheseItems(formatItems(data));
|
|
38
|
+
}, [setTheseItems, data]);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (window !== 'undefined' && window.innerWidth >= sizes.medium) {
|
|
42
|
+
// On inital render, update carousel plugin config
|
|
43
|
+
// to suit the non-mobile layout and functionality:
|
|
44
|
+
setIsMobileOrTablet(false);
|
|
45
|
+
setVisibleSlides(3);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Hook into browser's own onresize event to call our custom wrapper function:
|
|
49
|
+
if (typeof window !== 'undefined') window.onresize = screenResize;
|
|
50
|
+
}, [screenResize]);
|
|
51
|
+
|
|
52
|
+
if (theseItems && totalSlides === null) {
|
|
53
|
+
// Reflects our two dummy/bookend slides for non-mobile/tablet views:
|
|
54
|
+
setTotalSlides(isMobileOrTablet ? theseItems.length : theseItems.length + 2);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<CarouselWrapper
|
|
59
|
+
className="CarouselWrapper"
|
|
60
|
+
id={thisID}
|
|
61
|
+
mobileHeight={data.mobileHeight}
|
|
62
|
+
desktopHeight={data.desktopHeight}
|
|
63
|
+
>
|
|
64
|
+
|
|
65
|
+
<Heading tag="p" weight="bold">
|
|
66
|
+
{ data.heading}
|
|
67
|
+
</Heading>
|
|
68
|
+
|
|
69
|
+
<PeopleHelpedText tag="h1" family="Anton" uppercase weight="normal" color="red">
|
|
70
|
+
{ data.peopleHelpedText}
|
|
71
|
+
</PeopleHelpedText>
|
|
72
|
+
|
|
73
|
+
<Including tag="p">
|
|
74
|
+
including...
|
|
75
|
+
</Including>
|
|
76
|
+
|
|
77
|
+
{theseItems && (
|
|
78
|
+
<CarouselProvider
|
|
79
|
+
naturalSlideWidth={50}
|
|
80
|
+
naturalSlideHeight={200}
|
|
81
|
+
totalSlides={totalSlides}
|
|
82
|
+
isPlaying={autoPlay}
|
|
83
|
+
interval={5000}
|
|
84
|
+
visibleSlides={visibleSlides}
|
|
85
|
+
infinite
|
|
86
|
+
>
|
|
87
|
+
<Slider classNameAnimation="wymd-carousel">
|
|
88
|
+
|
|
89
|
+
{/* Dummy slide for our desired non-mobile layout and functionality */}
|
|
90
|
+
{isMobileOrTablet === false && (
|
|
91
|
+
<Slide index={0} key={0} />
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{Object.keys(theseItems).map((key, index) => {
|
|
95
|
+
// Reflect that initial dummy/bookend slide shown on non-mobile/tablet views:
|
|
96
|
+
const thisOffsetIndex = index + (isMobileOrTablet ? 0 : 1);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
// Calculate the index offset accordingly to reflect the number of slides,
|
|
100
|
+
// but use the REAL index when determining if its the last REAL slide
|
|
101
|
+
<Slide
|
|
102
|
+
index={thisOffsetIndex}
|
|
103
|
+
className={index === (theseItems.length - 1) && 'last-slide'}
|
|
104
|
+
key={thisOffsetIndex}
|
|
105
|
+
>
|
|
106
|
+
|
|
107
|
+
<ImageWrapper className="image-wrapper">
|
|
108
|
+
<img src={theseItems[key].image.file.url} alt={theseItems[key].copy} />
|
|
109
|
+
</ImageWrapper>
|
|
110
|
+
|
|
111
|
+
<AmountWrapper>
|
|
112
|
+
<Text tag="h1" family="Anton" uppercase weight="normal" size="super">
|
|
113
|
+
{theseItems[key].amount}
|
|
114
|
+
</Text>
|
|
115
|
+
</AmountWrapper>
|
|
116
|
+
|
|
117
|
+
<CopyWrapper>
|
|
118
|
+
<Text tag="p" size="l">
|
|
119
|
+
{theseItems[key].copy}
|
|
120
|
+
</Text>
|
|
121
|
+
</CopyWrapper>
|
|
122
|
+
</Slide>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
|
|
126
|
+
{/* Dummy slide for our desired non-mobile layout and functionality */}
|
|
127
|
+
{isMobileOrTablet === false && (
|
|
128
|
+
<Slide index={theseItems.length + 1} key="bookend-last" />
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
</Slider>
|
|
132
|
+
<ButtonBack>Back</ButtonBack>
|
|
133
|
+
<ButtonNext>Next</ButtonNext>
|
|
134
|
+
</CarouselProvider>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
</CarouselWrapper>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
WYMDCarousel.propTypes = {
|
|
142
|
+
data: PropTypes.shape({
|
|
143
|
+
// Required 'node' fields:
|
|
144
|
+
node1_Amount: PropTypes.string.isRequired,
|
|
145
|
+
node1_Copy: PropTypes.string.isRequired,
|
|
146
|
+
node1_Image: PropTypes.shape({
|
|
147
|
+
file: PropTypes.shape({
|
|
148
|
+
url: PropTypes.string.isRequired
|
|
149
|
+
}).isRequired
|
|
150
|
+
}).isRequired,
|
|
151
|
+
node2_Amount: PropTypes.string.isRequired,
|
|
152
|
+
node2_Copy: PropTypes.string.isRequired,
|
|
153
|
+
node2_Image: PropTypes.shape({
|
|
154
|
+
file: PropTypes.shape({
|
|
155
|
+
url: PropTypes.string.isRequired
|
|
156
|
+
}).isRequired
|
|
157
|
+
}).isRequired,
|
|
158
|
+
node3_Amount: PropTypes.string.isRequired,
|
|
159
|
+
node3_Copy: PropTypes.string.isRequired,
|
|
160
|
+
node3_Image: PropTypes.shape({
|
|
161
|
+
file: PropTypes.shape({
|
|
162
|
+
url: PropTypes.string.isRequired
|
|
163
|
+
}).isRequired
|
|
164
|
+
}).isRequired,
|
|
165
|
+
node4_Amount: PropTypes.string.isRequired,
|
|
166
|
+
node4_Copy: PropTypes.string.isRequired,
|
|
167
|
+
node4_Image: PropTypes.shape({
|
|
168
|
+
file: PropTypes.shape({
|
|
169
|
+
url: PropTypes.string.isRequired
|
|
170
|
+
}).isRequired
|
|
171
|
+
}).isRequired,
|
|
172
|
+
// Non-required 'node' fields:
|
|
173
|
+
node5_Amount: PropTypes.string,
|
|
174
|
+
node5_Copy: PropTypes.string,
|
|
175
|
+
node5_Image: PropTypes.shape({
|
|
176
|
+
file: PropTypes.shape({
|
|
177
|
+
url: PropTypes.string
|
|
178
|
+
})
|
|
179
|
+
}),
|
|
180
|
+
node6_Amount: PropTypes.string,
|
|
181
|
+
node6_Copy: PropTypes.string,
|
|
182
|
+
node6_Image: PropTypes.shape({
|
|
183
|
+
file: PropTypes.shape({
|
|
184
|
+
url: PropTypes.string
|
|
185
|
+
})
|
|
186
|
+
}),
|
|
187
|
+
node7_Amount: PropTypes.string,
|
|
188
|
+
node7_Copy: PropTypes.string,
|
|
189
|
+
node7_Image: PropTypes.shape({
|
|
190
|
+
file: PropTypes.shape({
|
|
191
|
+
url: PropTypes.string
|
|
192
|
+
})
|
|
193
|
+
}),
|
|
194
|
+
node8_Amount: PropTypes.string,
|
|
195
|
+
node8_Copy: PropTypes.string,
|
|
196
|
+
node8_Image: PropTypes.shape({
|
|
197
|
+
file: PropTypes.shape({
|
|
198
|
+
url: PropTypes.string
|
|
199
|
+
})
|
|
200
|
+
}),
|
|
201
|
+
node9_Amount: PropTypes.string,
|
|
202
|
+
node9_Copy: PropTypes.string,
|
|
203
|
+
node9_Image: PropTypes.shape({
|
|
204
|
+
file: PropTypes.shape({
|
|
205
|
+
url: PropTypes.string
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
node10_Amount: PropTypes.string,
|
|
209
|
+
node10_Copy: PropTypes.string,
|
|
210
|
+
node10_Image: PropTypes.shape({
|
|
211
|
+
file: PropTypes.shape({
|
|
212
|
+
url: PropTypes.string
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
node11_Amount: PropTypes.string,
|
|
216
|
+
node11_Copy: PropTypes.string,
|
|
217
|
+
node11_Image: PropTypes.shape({
|
|
218
|
+
file: PropTypes.shape({
|
|
219
|
+
url: PropTypes.string
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
node12_Amount: PropTypes.string,
|
|
223
|
+
node12_Copy: PropTypes.string,
|
|
224
|
+
node12_Image: PropTypes.shape({
|
|
225
|
+
file: PropTypes.shape({
|
|
226
|
+
url: PropTypes.string
|
|
227
|
+
})
|
|
228
|
+
}),
|
|
229
|
+
autoPlay: PropTypes.bool.isRequired,
|
|
230
|
+
heading: PropTypes.string.isRequired,
|
|
231
|
+
peopleHelpedText: PropTypes.string.isRequired,
|
|
232
|
+
contentful_id: PropTypes.string.isRequired,
|
|
233
|
+
mobileHeight: PropTypes.number,
|
|
234
|
+
desktopHeight: PropTypes.number
|
|
235
|
+
}).isRequired
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export default WYMDCarousel;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 'What Your Money Does' Carousel
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
const { carouselItemsComplete } = require('../../../styleguide/data/data');
|
|
5
|
+
import Text from '../../Atoms/Text/Text';
|
|
6
|
+
|
|
7
|
+
<div>
|
|
8
|
+
<h2 style={{textAlign: 'center'}}>
|
|
9
|
+
All fields supplied, autoplay on:
|
|
10
|
+
</h2>
|
|
11
|
+
<WYMDCarousel data={carouselItemsComplete}/>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const { carouselItemsIncomplete } = require('../../../styleguide/data/data');
|
|
18
|
+
import Text from '../../Atoms/Text/Text';
|
|
19
|
+
|
|
20
|
+
<div>
|
|
21
|
+
<h2 style={{textAlign: 'center'}}>
|
|
22
|
+
All REQUIRED fields supplied (nodes 1-4), various incomplete nodes, node 11 complete, autoplay off:
|
|
23
|
+
</h2>
|
|
24
|
+
<WYMDCarousel data={carouselItemsIncomplete}/>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const { carouselItemsMinimal } = require('../../../styleguide/data/data');
|
|
31
|
+
import Text from '../../Atoms/Text/Text';
|
|
32
|
+
|
|
33
|
+
<div>
|
|
34
|
+
<h2 style={{textAlign: 'center'}}>
|
|
35
|
+
All REQUIRED fields supplied (nodes 1-4), autoplay off:
|
|
36
|
+
</h2>
|
|
37
|
+
<WYMDCarousel data={carouselItemsMinimal}/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
```
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import spacing from '../../../theme/shared/spacing';
|
|
3
|
+
import Text from '../../Atoms/Text/Text';
|
|
4
|
+
|
|
5
|
+
// Duration in seconds
|
|
6
|
+
const animationSpeed = 0.5;
|
|
7
|
+
|
|
8
|
+
const ImageWrapper = styled.div`
|
|
9
|
+
width: 33%;
|
|
10
|
+
display: block;
|
|
11
|
+
padding: 7%;
|
|
12
|
+
border: 2px dashed #89888b;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
position: relative;
|
|
15
|
+
overflow: visible;
|
|
16
|
+
|
|
17
|
+
img {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: auto;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:after {
|
|
23
|
+
position: absolute;
|
|
24
|
+
content: '';
|
|
25
|
+
top: 50%;
|
|
26
|
+
width: 200%;
|
|
27
|
+
right: calc(-200% - 8px);
|
|
28
|
+
height: 2px;
|
|
29
|
+
border-bottom: 2px dashed #89888b;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
33
|
+
width: 50%;
|
|
34
|
+
padding: 9%;
|
|
35
|
+
&:after {
|
|
36
|
+
width: 100%;
|
|
37
|
+
right: calc(-100% - 8px);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const AmountWrapper = styled.div`
|
|
43
|
+
padding: ${spacing('m')} 0;
|
|
44
|
+
width: 75%;
|
|
45
|
+
margin: 0 auto;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const CopyWrapper = styled.div`
|
|
49
|
+
padding: ${spacing('sm')} 0;
|
|
50
|
+
width: 75%;
|
|
51
|
+
margin: 0 auto;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const Heading = styled(Text)`
|
|
55
|
+
width: 75%;
|
|
56
|
+
margin: 0 auto;
|
|
57
|
+
|
|
58
|
+
// To override pre-existing first-child rule
|
|
59
|
+
&:first-child {
|
|
60
|
+
margin-bottom: ${spacing('l')};
|
|
61
|
+
text-align: center;
|
|
62
|
+
font-size: 20px;
|
|
63
|
+
line-height: 23px;
|
|
64
|
+
|
|
65
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
66
|
+
font-size: 21px;
|
|
67
|
+
line-height: 23px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
const PeopleHelpedText = styled(Text)`
|
|
73
|
+
margin-bottom: ${spacing('l')};
|
|
74
|
+
text-align: center;
|
|
75
|
+
font-size: 40px;
|
|
76
|
+
line-height: 40px;
|
|
77
|
+
|
|
78
|
+
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
79
|
+
font-size: 60px;
|
|
80
|
+
line-height: 60px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
84
|
+
font-size: 75px;
|
|
85
|
+
line-height: 78px;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
const Including = styled(Text)`
|
|
90
|
+
margin-bottom: 0;
|
|
91
|
+
text-align: center;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
line-height: 17px;
|
|
94
|
+
|
|
95
|
+
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
96
|
+
font-size: 17px;
|
|
97
|
+
line-height: 19px;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
// Unfortunately having to target plugin-created markup ye olde fashioned way:
|
|
102
|
+
const CarouselWrapper = styled.div`
|
|
103
|
+
height: 100%;
|
|
104
|
+
padding: ${spacing('m')};
|
|
105
|
+
|
|
106
|
+
.carousel {
|
|
107
|
+
position: relative;
|
|
108
|
+
margin: 0 auto;
|
|
109
|
+
padding-top: ${spacing('l')};
|
|
110
|
+
|
|
111
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
112
|
+
padding-top: ${spacing('lg')};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
button.carousel__back-button,
|
|
116
|
+
button.carousel__next-button {
|
|
117
|
+
position: absolute;
|
|
118
|
+
left: 0;
|
|
119
|
+
top: 0;
|
|
120
|
+
width: 33% !important;
|
|
121
|
+
height: 100%;
|
|
122
|
+
padding: 0 !important;
|
|
123
|
+
box-shadow: none;
|
|
124
|
+
text-indent: -9999px;
|
|
125
|
+
background-color: transparent;
|
|
126
|
+
border: none;
|
|
127
|
+
|
|
128
|
+
&:before {
|
|
129
|
+
content: '';
|
|
130
|
+
// Do we need some sort of icon here to show it's a button?
|
|
131
|
+
// background: transparent url(/images/payin/CR__Chevron_D--white.svg) no-repeat;
|
|
132
|
+
position: absolute;
|
|
133
|
+
width: 30px;
|
|
134
|
+
height: 30px;
|
|
135
|
+
top: 50%;
|
|
136
|
+
left: 0;
|
|
137
|
+
transform: translate(0, -50%) rotate(90deg);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:after {
|
|
141
|
+
content: "";
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 0;
|
|
144
|
+
left: 0;
|
|
145
|
+
width: 50%;
|
|
146
|
+
height: 100%;
|
|
147
|
+
transition: opacity 0.2s linear;
|
|
148
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0.95),
|
|
149
|
+
rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
// TO-DO: accessibiity?
|
|
155
|
+
// border: 1px solid black;
|
|
156
|
+
&:after {
|
|
157
|
+
opacity: 0.5;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
162
|
+
width: 33.3% !important;
|
|
163
|
+
&:after {
|
|
164
|
+
width: 100%;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
button.carousel__next-button {
|
|
170
|
+
left: auto;
|
|
171
|
+
right: 0;
|
|
172
|
+
|
|
173
|
+
&:before {
|
|
174
|
+
transform: translate(0, -50%) rotate(-90deg);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:after {
|
|
178
|
+
left: auto;
|
|
179
|
+
right: 0;
|
|
180
|
+
background: linear-gradient(270deg, rgba(255, 255, 255, 0.95),
|
|
181
|
+
rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.wymd-carousel {
|
|
186
|
+
// Override default animations
|
|
187
|
+
transition: -webkit-transform ${animationSpeed}s;
|
|
188
|
+
-o-transition: transform ${animationSpeed}s;
|
|
189
|
+
transition: transform ${animationSpeed}s;
|
|
190
|
+
-webkit-transform: ${animationSpeed}s;
|
|
191
|
+
will-change: transform;
|
|
192
|
+
|
|
193
|
+
.last-slide {
|
|
194
|
+
.image-wrapper:after {
|
|
195
|
+
content: none;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.carousel__slide {
|
|
200
|
+
padding-bottom: ${props => props.mobileHeight}px !important;
|
|
201
|
+
|
|
202
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
203
|
+
padding-bottom: ${props => props.desktopHeight}px !important;
|
|
204
|
+
|
|
205
|
+
// All slides:
|
|
206
|
+
.carousel__inner-slide {
|
|
207
|
+
// All 'ImageWrappers':
|
|
208
|
+
> div:first-child {
|
|
209
|
+
transition: transform ${animationSpeed}s ease;
|
|
210
|
+
transform: scale(0.5);
|
|
211
|
+
|
|
212
|
+
&:after {
|
|
213
|
+
transition: transform ${animationSpeed}s ease,
|
|
214
|
+
width ${animationSpeed}s ease,
|
|
215
|
+
right ${animationSpeed}s ease;
|
|
216
|
+
right: calc(-300% - 6px);
|
|
217
|
+
transform: scale(1);
|
|
218
|
+
width: 300%;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Our 'first' slide of the three:
|
|
224
|
+
&.carousel__slide--visible {
|
|
225
|
+
.carousel__inner-slide {
|
|
226
|
+
> div:first-child {
|
|
227
|
+
&:after {
|
|
228
|
+
right: calc(-250% - 6px);
|
|
229
|
+
transform: scale(1);
|
|
230
|
+
width: 250%;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
// 2nd and 3rd:
|
|
237
|
+
+ .carousel__slide--visible {
|
|
238
|
+
.carousel__inner-slide {
|
|
239
|
+
> div:first-child {
|
|
240
|
+
transform: scale(1);
|
|
241
|
+
&:after {
|
|
242
|
+
right: calc(-187% - 6px);
|
|
243
|
+
transform: scale(0.5);
|
|
244
|
+
width: 250%;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Resets the 3rd slide:
|
|
250
|
+
+ .carousel__slide--visible {
|
|
251
|
+
> div > div:first-child {
|
|
252
|
+
transform: scale(0.5);
|
|
253
|
+
&:after {
|
|
254
|
+
right: calc(-250% - 6px);
|
|
255
|
+
transform: scale(1);
|
|
256
|
+
width: 250%;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.carousel__inner-slide {
|
|
265
|
+
text-align: center;
|
|
266
|
+
display: inline-flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
justify-content: flex-start;
|
|
269
|
+
flex-direction: column;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
275
|
+
|
|
276
|
+
export {
|
|
277
|
+
CarouselWrapper, ImageWrapper, AmountWrapper, CopyWrapper, Heading, PeopleHelpedText, Including
|
|
278
|
+
};
|