@eeacms/volto-eea-design-system 1.13.2 → 1.15.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/CHANGELOG.md +61 -17
- package/package.json +2 -2
- package/src/helpers/eventHandlers.js +6 -0
- package/src/helpers/index.js +1 -0
- package/src/ui/Card/Card.stories.jsx +261 -347
- package/src/ui/Card/IconCard/IconCard.stories.jsx +22 -2
- package/src/ui/Header/Header.jsx +12 -0
- package/src/ui/Header/HeaderSearchPopUp.js +9 -11
- package/src/ui/Popup/Popup.stories.jsx +1 -1
- package/src/ui/Statistic/Statistic.stories.js +122 -104
- package/theme/themes/eea/elements/input.overrides +19 -6
- package/theme/themes/eea/elements/label.overrides +12 -4
- package/theme/themes/eea/elements/label.variables +17 -15
- package/theme/themes/eea/extras/contentBox.less +1 -1
- package/theme/themes/eea/extras/contentBox.variables +1 -0
- package/theme/themes/eea/extras/header.less +3 -3
- package/theme/themes/eea/extras/header.variables +3 -3
- package/theme/themes/eea/extras/main.overrides +6 -0
- package/theme/themes/eea/globals/site.overrides +17 -18
- package/theme/themes/eea/globals/site.variables +3 -0
- package/theme/themes/eea/views/card.overrides +29 -3
- package/theme/themes/eea/views/card.variables +15 -5
- /package/src/ui/Hero/{Hero.stories.jsx → Hero.st.jsx} +0 -0
|
@@ -8,6 +8,72 @@ import 'slick-carousel/slick/slick-theme.css';
|
|
|
8
8
|
const tabletBreakpoint = 835;
|
|
9
9
|
const mobileBreakpoint = 480;
|
|
10
10
|
|
|
11
|
+
let cardModels = [
|
|
12
|
+
{
|
|
13
|
+
title: 'Economy and resources',
|
|
14
|
+
imgUrl:
|
|
15
|
+
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
16
|
+
description:
|
|
17
|
+
'The economy plays a vital role in our lives by providing access to employment, ' +
|
|
18
|
+
'products and services that help us thrive. Unfortunately, with its key sectors like agriculture,' +
|
|
19
|
+
' energy and transport, our economy also harms the environment and causes climate change. ' +
|
|
20
|
+
'Europe needs a circular, carbon-neutral and zero-pollution economy. ',
|
|
21
|
+
meta: 'Article',
|
|
22
|
+
metaRight: '20/05/2022',
|
|
23
|
+
href: '/#',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: 'Health',
|
|
27
|
+
imgUrl:
|
|
28
|
+
'https://www.eea.europa.eu/en/topics/at-a-glance/health/@@images/image/preview',
|
|
29
|
+
description:
|
|
30
|
+
'By improving air, water, and soil quality and limiting pollution released to nature, ' +
|
|
31
|
+
'the EU has significantly contributed to enhancing human health in the last five ' +
|
|
32
|
+
'decades. Yet, many vulnerable groups continue to be impacted by environmental ' +
|
|
33
|
+
'degradation and climate change. Further improvements can help keep Europeans ' +
|
|
34
|
+
'healthier and better equipped to cope with climate change impacts.',
|
|
35
|
+
meta: 'Article',
|
|
36
|
+
metaRight: '30/06/2023',
|
|
37
|
+
href: '/#',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Nature',
|
|
41
|
+
imgUrl:
|
|
42
|
+
'https://www.eea.europa.eu/en/topics/at-a-glance/nature/@@images/image/preview',
|
|
43
|
+
description:
|
|
44
|
+
'Europe’s nature is filled with forests, mountains, vast plains, long rivers, deep blue seas and ' +
|
|
45
|
+
'refreshing lakes. But it also is under threat. Unsustainable farming and forestry practices, ' +
|
|
46
|
+
'pollution, climate change and invasive species are stressing and destabilising all natural ' +
|
|
47
|
+
'systems in Europe. The result is a biodiversity crisis. The EU is taking steps to protect and restore nature.',
|
|
48
|
+
meta: 'Article',
|
|
49
|
+
metaRight: '10/04/2022',
|
|
50
|
+
href: '/#',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: 'Climate',
|
|
54
|
+
meta: 'Article',
|
|
55
|
+
imgUrl:
|
|
56
|
+
'https://www.eea.europa.eu/en/topics/at-a-glance/climate/@@images/image/preview',
|
|
57
|
+
description:
|
|
58
|
+
'Climate change affects us all and is accelerating. Its impacts will become even more severe if ' +
|
|
59
|
+
'the increase in global temperature is not kept below 1.5°C. The EU and its Member States are ' +
|
|
60
|
+
'taking important steps to rapidly reduce greenhouse gas emissions and adapt to climate change.',
|
|
61
|
+
href: '/#',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: "State of Europe's environment",
|
|
65
|
+
imgUrl:
|
|
66
|
+
'https://www.eea.europa.eu/en/topics/at-a-glance/state-of-europes-environment/@@images/image/preview',
|
|
67
|
+
description:
|
|
68
|
+
'EU environment and climate policies have delivered substantial benefits over recent ' +
|
|
69
|
+
'decades, such as cleaner air and water. Nevertheless, Europe, as well as the rest ' +
|
|
70
|
+
'of the globe, is facing environmental challenges of unprecedented scale and urgency.',
|
|
71
|
+
meta: 'Article',
|
|
72
|
+
metaRight: '16/03/2022',
|
|
73
|
+
href: '/#',
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
11
77
|
export default {
|
|
12
78
|
title: 'Components/Card/Default',
|
|
13
79
|
component: Card,
|
|
@@ -49,6 +115,12 @@ export default {
|
|
|
49
115
|
type: { summary: 'boolean' },
|
|
50
116
|
},
|
|
51
117
|
},
|
|
118
|
+
fluid: {
|
|
119
|
+
table: {
|
|
120
|
+
defaultValue: { summary: 'false' },
|
|
121
|
+
type: { summary: 'boolean' },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
52
124
|
objectFit: {
|
|
53
125
|
name: 'Image fit',
|
|
54
126
|
options: ['unset', 'cover', 'contain', 'fill', 'scale-down'],
|
|
@@ -67,6 +139,15 @@ export default {
|
|
|
67
139
|
defaultValue: { summary: 'center' },
|
|
68
140
|
},
|
|
69
141
|
},
|
|
142
|
+
numberOfCards: {
|
|
143
|
+
name: 'Number of cards',
|
|
144
|
+
options: [1, 2, 3, 4, 5],
|
|
145
|
+
control: { type: 'select' },
|
|
146
|
+
table: {
|
|
147
|
+
defaultValue: { summary: 3 },
|
|
148
|
+
type: { summary: 'number' },
|
|
149
|
+
},
|
|
150
|
+
},
|
|
70
151
|
titleMaxLines: {
|
|
71
152
|
name: 'Title max lines',
|
|
72
153
|
options: ['none', '1', '2', '3', '4', '5'],
|
|
@@ -98,6 +179,19 @@ export default {
|
|
|
98
179
|
},
|
|
99
180
|
};
|
|
100
181
|
|
|
182
|
+
const CardImage = (card) => (
|
|
183
|
+
<a href={card.href} className={'image'}>
|
|
184
|
+
<Image src={card.imgUrl} ui={false} alt="card image" />
|
|
185
|
+
<div className="gradient">
|
|
186
|
+
<Card.Header>{card.title}</Card.Header>
|
|
187
|
+
</div>
|
|
188
|
+
</a>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const MetaRight = (args) => (
|
|
192
|
+
<span className="bold text-right">{args.metaRight}</span>
|
|
193
|
+
);
|
|
194
|
+
|
|
101
195
|
const CardTemplate = ({
|
|
102
196
|
variant,
|
|
103
197
|
inverted,
|
|
@@ -107,10 +201,11 @@ const CardTemplate = ({
|
|
|
107
201
|
objectPosition,
|
|
108
202
|
titleMaxLines,
|
|
109
203
|
maxLines,
|
|
204
|
+
fluid,
|
|
110
205
|
card,
|
|
111
206
|
}) => (
|
|
112
207
|
<Card
|
|
113
|
-
fluid={
|
|
208
|
+
fluid={fluid}
|
|
114
209
|
className={`u-card ${variant === 'default' ? '' : variant} ${
|
|
115
210
|
inverted ? 'inverted' : ''
|
|
116
211
|
} ${variant} ${rounded ? 'rounded' : ''} ${
|
|
@@ -118,27 +213,21 @@ const CardTemplate = ({
|
|
|
118
213
|
} ${
|
|
119
214
|
objectPosition === 'none' ? '' : 'has--object-position--' + objectPosition
|
|
120
215
|
} ${
|
|
121
|
-
titleMaxLines === 'none'
|
|
122
|
-
|
|
123
|
-
: 'title-max-' + titleMaxLines + '-lines'
|
|
124
|
-
} ${maxLines === 'none' ? 'max-0-lines' : 'max-' + maxLines + '-lines'}`}
|
|
216
|
+
titleMaxLines === 'none' ? '' : 'title-max-' + titleMaxLines + '-lines'
|
|
217
|
+
} ${maxLines === 'none' ? '' : 'max-' + maxLines + '-lines'}`}
|
|
125
218
|
>
|
|
126
219
|
{/* Card Image */}
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
<CardImage {...card} />
|
|
130
|
-
) : (
|
|
131
|
-
<Image
|
|
132
|
-
as="a"
|
|
133
|
-
href={card.href}
|
|
134
|
-
src={card.imgUrl}
|
|
135
|
-
wrapped
|
|
136
|
-
ui={false}
|
|
137
|
-
alt="card image"
|
|
138
|
-
/>
|
|
139
|
-
)
|
|
220
|
+
{titleOnImage ? (
|
|
221
|
+
<CardImage {...card} />
|
|
140
222
|
) : (
|
|
141
|
-
|
|
223
|
+
<Image
|
|
224
|
+
as="a"
|
|
225
|
+
href={card.href}
|
|
226
|
+
src={card.imgUrl}
|
|
227
|
+
wrapped
|
|
228
|
+
ui={false}
|
|
229
|
+
alt="card image"
|
|
230
|
+
/>
|
|
142
231
|
)}
|
|
143
232
|
<Card.Content>
|
|
144
233
|
{/* Type & Date */}
|
|
@@ -147,7 +236,7 @@ const CardTemplate = ({
|
|
|
147
236
|
</Card.Meta>
|
|
148
237
|
|
|
149
238
|
{/* Title */}
|
|
150
|
-
{!titleOnImage
|
|
239
|
+
{!titleOnImage ? (
|
|
151
240
|
<Card.Header>
|
|
152
241
|
<a href={card.href}>{card.title}</a>
|
|
153
242
|
</Card.Header>
|
|
@@ -169,34 +258,10 @@ const CardTemplate = ({
|
|
|
169
258
|
</Card>
|
|
170
259
|
);
|
|
171
260
|
|
|
172
|
-
const CardImage = (card) => (
|
|
173
|
-
<a href={card.href} className={'image'}>
|
|
174
|
-
<Image src={card.imgUrl} ui={false} alt="card image" />
|
|
175
|
-
<div className="gradient">
|
|
176
|
-
<Card.Header>{card.title}</Card.Header>
|
|
177
|
-
</div>
|
|
178
|
-
</a>
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
const MetaRight = (args) => (
|
|
182
|
-
<span className="bold text-right">{args.metaRight}</span>
|
|
183
|
-
);
|
|
184
|
-
|
|
185
261
|
const Template = (args) => (
|
|
186
262
|
<Container>
|
|
187
|
-
{args.cards.map((card, index) => (
|
|
188
|
-
<CardTemplate
|
|
189
|
-
variant={args.variant}
|
|
190
|
-
titleOnImage={args.titleOnImage}
|
|
191
|
-
inverted={args.inverted}
|
|
192
|
-
rounded={args.rounded}
|
|
193
|
-
objectFit={args.objectFit}
|
|
194
|
-
objectPosition={args.objectPosition}
|
|
195
|
-
titleMaxLines={args.titleMaxLines}
|
|
196
|
-
maxLines={args.maxLines}
|
|
197
|
-
card={card}
|
|
198
|
-
key={index}
|
|
199
|
-
/>
|
|
263
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
264
|
+
<CardTemplate {...args} card={card} key={index} />
|
|
200
265
|
))}
|
|
201
266
|
</Container>
|
|
202
267
|
);
|
|
@@ -211,39 +276,16 @@ Default.args = {
|
|
|
211
276
|
objectPosition: 'center',
|
|
212
277
|
titleMaxLines: '2',
|
|
213
278
|
maxLines: '2',
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
imgUrl:
|
|
218
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
219
|
-
description:
|
|
220
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
221
|
-
hasImage: true,
|
|
222
|
-
meta: 'Article',
|
|
223
|
-
metaRight: '30/07/2022',
|
|
224
|
-
href: '/#',
|
|
225
|
-
fluid: false,
|
|
226
|
-
},
|
|
227
|
-
],
|
|
279
|
+
numberOfCards: 1,
|
|
280
|
+
fluid: false,
|
|
281
|
+
cards: [...cardModels],
|
|
228
282
|
};
|
|
229
|
-
|
|
230
283
|
const GridTemplate = (args) => (
|
|
231
284
|
<Container>
|
|
232
285
|
<Grid>
|
|
233
|
-
{args.cards.map((card, index) => (
|
|
286
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
234
287
|
<Grid.Column mobile={12} tablet={6} computer={4} key={index}>
|
|
235
|
-
<CardTemplate
|
|
236
|
-
variant={args.variant}
|
|
237
|
-
titleOnImage={args.titleOnImage}
|
|
238
|
-
inverted={args.inverted}
|
|
239
|
-
rounded={args.rounded}
|
|
240
|
-
objectFit={args.objectFit}
|
|
241
|
-
objectPosition={args.objectPosition}
|
|
242
|
-
titleMaxLines={args.titleMaxLines}
|
|
243
|
-
maxLines={args.maxLines}
|
|
244
|
-
card={card}
|
|
245
|
-
key={index}
|
|
246
|
-
/>
|
|
288
|
+
<CardTemplate {...args} card={card} key={index} />
|
|
247
289
|
</Grid.Column>
|
|
248
290
|
))}
|
|
249
291
|
</Grid>
|
|
@@ -260,100 +302,79 @@ CardGrid.args = {
|
|
|
260
302
|
objectPosition: 'center',
|
|
261
303
|
titleMaxLines: '2',
|
|
262
304
|
maxLines: '2',
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
imgUrl:
|
|
267
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
268
|
-
description:
|
|
269
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
270
|
-
hasImage: true,
|
|
271
|
-
meta: 'Article',
|
|
272
|
-
metaRight: '30/07/2022',
|
|
273
|
-
href: '/#',
|
|
274
|
-
fluid: true,
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
title: 'Economy and resources',
|
|
278
|
-
imgUrl:
|
|
279
|
-
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
280
|
-
description:
|
|
281
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
282
|
-
hasImage: true,
|
|
283
|
-
meta: 'Article',
|
|
284
|
-
metaRight: '30/07/2022',
|
|
285
|
-
href: '/#',
|
|
286
|
-
fluid: true,
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
title: "State of Europe's environment",
|
|
290
|
-
imgUrl:
|
|
291
|
-
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
292
|
-
description:
|
|
293
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis. Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
294
|
-
hasImage: true,
|
|
295
|
-
meta: 'Article',
|
|
296
|
-
metaRight: '30/07/2022',
|
|
297
|
-
href: '/#',
|
|
298
|
-
fluid: true,
|
|
299
|
-
},
|
|
300
|
-
],
|
|
305
|
+
fluid: true,
|
|
306
|
+
numberOfCards: 5,
|
|
307
|
+
cards: [...cardModels],
|
|
301
308
|
};
|
|
302
309
|
|
|
303
|
-
|
|
310
|
+
const ImageCard = ({
|
|
311
|
+
variant,
|
|
312
|
+
inverted,
|
|
313
|
+
rounded,
|
|
314
|
+
objectFit,
|
|
315
|
+
objectPosition,
|
|
316
|
+
fluid,
|
|
317
|
+
card,
|
|
318
|
+
}) => (
|
|
319
|
+
<div
|
|
320
|
+
className={`ui card u-card ${fluid ? 'fluid' : ''} ${
|
|
321
|
+
inverted ? 'inverted' : ''
|
|
322
|
+
} ${variant} ${rounded ? 'rounded' : ''} ${
|
|
323
|
+
objectFit === 'unset' ? '' : 'has--object-fit--' + objectFit
|
|
324
|
+
} ${
|
|
325
|
+
objectPosition === 'none' ? '' : 'has--object-position--' + objectPosition
|
|
326
|
+
} `}
|
|
327
|
+
>
|
|
328
|
+
<a className="image" href={card.href}>
|
|
329
|
+
<img src={card.imgUrl} alt={card.title} className="ui image" />
|
|
330
|
+
</a>
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
const ImageCardTemplate = (args) => (
|
|
335
|
+
<Container>
|
|
336
|
+
<div className="items imageCard-items">
|
|
337
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
338
|
+
<ImageCard {...args} card={card} key={index} />
|
|
339
|
+
))}
|
|
340
|
+
</div>
|
|
341
|
+
</Container>
|
|
342
|
+
);
|
|
343
|
+
export const ImageGrid = ImageCardTemplate.bind({});
|
|
304
344
|
ImageGrid.args = {
|
|
305
|
-
titleOnImage: true,
|
|
306
345
|
variant: 'default',
|
|
307
346
|
inverted: false,
|
|
308
347
|
rounded: false,
|
|
309
348
|
objectFit: 'center',
|
|
310
349
|
objectPosition: 'cover',
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
fluid: true,
|
|
350
|
+
fluid: true,
|
|
351
|
+
cards: [...cardModels],
|
|
352
|
+
numberOfCards: 5,
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
ImageGrid.argTypes = {
|
|
356
|
+
titleOnImage: {
|
|
357
|
+
table: {
|
|
358
|
+
disable: true,
|
|
321
359
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
hasImage: true,
|
|
327
|
-
href: '/#',
|
|
328
|
-
fluid: true,
|
|
360
|
+
},
|
|
361
|
+
titleMaxLines: {
|
|
362
|
+
table: {
|
|
363
|
+
disable: true,
|
|
329
364
|
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
hasImage: true,
|
|
335
|
-
href: '/#',
|
|
336
|
-
fluid: true,
|
|
365
|
+
},
|
|
366
|
+
maxLines: {
|
|
367
|
+
table: {
|
|
368
|
+
disable: true,
|
|
337
369
|
},
|
|
338
|
-
|
|
370
|
+
},
|
|
339
371
|
};
|
|
340
372
|
|
|
341
373
|
const FluidGridTemplate = (args) => (
|
|
342
374
|
<Container>
|
|
343
375
|
<div className="fluid-card-row">
|
|
344
|
-
{args.cards.map((card, index) => (
|
|
345
|
-
<CardTemplate
|
|
346
|
-
variant={args.variant}
|
|
347
|
-
titleOnImage={args.titleOnImage}
|
|
348
|
-
inverted={args.inverted}
|
|
349
|
-
rounded={args.rounded}
|
|
350
|
-
objectFit={args.objectFit}
|
|
351
|
-
objectPosition={args.objectPosition}
|
|
352
|
-
titleMaxLines={args.titleMaxLines}
|
|
353
|
-
maxLines={args.maxLines}
|
|
354
|
-
card={card}
|
|
355
|
-
key={index}
|
|
356
|
-
/>
|
|
376
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
377
|
+
<CardTemplate {...args} card={card} key={index} />
|
|
357
378
|
))}
|
|
358
379
|
</div>
|
|
359
380
|
</Container>
|
|
@@ -369,111 +390,74 @@ FluidGrid.args = {
|
|
|
369
390
|
objectPosition: 'center',
|
|
370
391
|
titleMaxLines: '2',
|
|
371
392
|
maxLines: '2',
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
imgUrl:
|
|
376
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
377
|
-
description:
|
|
378
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
379
|
-
hasImage: true,
|
|
380
|
-
meta: 'Article',
|
|
381
|
-
metaRight: '30/07/2022',
|
|
382
|
-
href: '/#',
|
|
383
|
-
fluid: true,
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
title: 'Health',
|
|
387
|
-
imgUrl:
|
|
388
|
-
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
389
|
-
description:
|
|
390
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
391
|
-
hasImage: true,
|
|
392
|
-
meta: 'Article',
|
|
393
|
-
metaRight: '30/07/2022',
|
|
394
|
-
href: '/#',
|
|
395
|
-
fluid: true,
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
title: "State of Europe's environment",
|
|
399
|
-
imgUrl:
|
|
400
|
-
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
401
|
-
description:
|
|
402
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis. Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
403
|
-
hasImage: true,
|
|
404
|
-
meta: 'Article',
|
|
405
|
-
metaRight: '30/07/2022',
|
|
406
|
-
href: '/#',
|
|
407
|
-
fluid: true,
|
|
408
|
-
},
|
|
409
|
-
],
|
|
393
|
+
numberOfCards: 3,
|
|
394
|
+
fluid: true,
|
|
395
|
+
cards: [...cardModels],
|
|
410
396
|
};
|
|
397
|
+
const PrevArrow = (props) => {
|
|
398
|
+
const { onClick } = props;
|
|
411
399
|
|
|
412
|
-
|
|
413
|
-
|
|
400
|
+
return (
|
|
401
|
+
<Button
|
|
402
|
+
aria-label="Previous slide"
|
|
403
|
+
className="slider-arrow prev-arrow tablet or lower hidden"
|
|
404
|
+
icon
|
|
405
|
+
onClick={onClick}
|
|
406
|
+
>
|
|
407
|
+
<Icon className="ri-arrow-left-s-line" />
|
|
408
|
+
</Button>
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const NextArrow = (props) => {
|
|
413
|
+
const { onClick } = props;
|
|
414
414
|
|
|
415
415
|
return (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
}}
|
|
426
|
-
>
|
|
427
|
-
<Icon className="ri-arrow-left-s-line" />
|
|
428
|
-
</Button>
|
|
429
|
-
<Button
|
|
430
|
-
aria-label="Next slide"
|
|
431
|
-
className="slider-arrow next-arrow tablet or lower hidden"
|
|
432
|
-
icon
|
|
433
|
-
onClick={() => {
|
|
434
|
-
if (slider.current) {
|
|
435
|
-
slider.current.slickNext();
|
|
436
|
-
}
|
|
437
|
-
}}
|
|
438
|
-
>
|
|
439
|
-
<Icon className="ri-arrow-right-s-line" />
|
|
440
|
-
</Button>
|
|
441
|
-
</>
|
|
416
|
+
<Button
|
|
417
|
+
aria-label="Next slide"
|
|
418
|
+
className="slider-arrow next-arrow tablet or lower hidden"
|
|
419
|
+
icon
|
|
420
|
+
onClick={onClick}
|
|
421
|
+
>
|
|
422
|
+
<Icon className="ri-arrow-right-s-line" />
|
|
423
|
+
</Button>
|
|
442
424
|
);
|
|
443
425
|
};
|
|
444
426
|
|
|
445
|
-
function CarouselCardsContent({
|
|
446
|
-
titleOnImage,
|
|
447
|
-
variant,
|
|
448
|
-
inverted,
|
|
449
|
-
rounded,
|
|
450
|
-
objectFit,
|
|
451
|
-
settings,
|
|
452
|
-
objectPosition,
|
|
453
|
-
titleMaxLines,
|
|
454
|
-
maxLines,
|
|
455
|
-
cards,
|
|
456
|
-
}) {
|
|
427
|
+
function CarouselCardsContent(args) {
|
|
457
428
|
const slider = React.useRef(null);
|
|
429
|
+
const dots_parent = React.useRef(null);
|
|
430
|
+
const settings = {
|
|
431
|
+
...args.settings,
|
|
432
|
+
customPaging: (i) => (
|
|
433
|
+
<button className={'slider-dots-button'} aria-current={i === 0}>
|
|
434
|
+
<span className="slick-dot-icon" aria-hidden="true" />
|
|
435
|
+
<span className="slick-sr-only">Go to slide {i + 1}</span>
|
|
436
|
+
</button>
|
|
437
|
+
),
|
|
438
|
+
appendDots: (dots) => (
|
|
439
|
+
<ul ref={dots_parent} className={'slick-dots'}>
|
|
440
|
+
{dots}
|
|
441
|
+
</ul>
|
|
442
|
+
),
|
|
443
|
+
afterChange: (currentSlide) => {
|
|
444
|
+
const dots = dots_parent.current;
|
|
445
|
+
if (dots) {
|
|
446
|
+
dots
|
|
447
|
+
.querySelectorAll('.slider-dots-button')
|
|
448
|
+
.forEach(function (el, idx) {
|
|
449
|
+
el.setAttribute('aria-current', idx === currentSlide);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
};
|
|
458
454
|
return (
|
|
459
|
-
<div className="cards-carousel">
|
|
455
|
+
<div className="cards-carousel" role={'region'} aria-label={'carousel'}>
|
|
460
456
|
<Slider {...settings} ref={slider}>
|
|
461
|
-
{cards.map((card, index) => (
|
|
462
|
-
<CardTemplate
|
|
463
|
-
variant={variant}
|
|
464
|
-
titleOnImage={titleOnImage}
|
|
465
|
-
inverted={inverted}
|
|
466
|
-
rounded={rounded}
|
|
467
|
-
objectFit={objectFit}
|
|
468
|
-
objectPosition={objectPosition}
|
|
469
|
-
titleMaxLines={titleMaxLines}
|
|
470
|
-
maxLines={maxLines}
|
|
471
|
-
card={card}
|
|
472
|
-
key={index}
|
|
473
|
-
/>
|
|
457
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
458
|
+
<CardTemplate {...args} card={card} key={index} />
|
|
474
459
|
))}
|
|
475
460
|
</Slider>
|
|
476
|
-
<Arrows slider={slider} />
|
|
477
461
|
</div>
|
|
478
462
|
);
|
|
479
463
|
}
|
|
@@ -494,12 +478,15 @@ CarouselCards.args = {
|
|
|
494
478
|
objectPosition: 'center',
|
|
495
479
|
titleMaxLines: '2',
|
|
496
480
|
maxLines: '2',
|
|
481
|
+
fluid: true,
|
|
497
482
|
settings: {
|
|
498
483
|
dots: true,
|
|
499
484
|
infinite: true,
|
|
500
485
|
slidesToShow: 4,
|
|
501
486
|
slidesToScroll: 1,
|
|
502
|
-
arrows:
|
|
487
|
+
arrows: true,
|
|
488
|
+
nextArrow: <NextArrow />,
|
|
489
|
+
prevArrow: <PrevArrow />,
|
|
503
490
|
responsive: [
|
|
504
491
|
{
|
|
505
492
|
breakpoint: tabletBreakpoint,
|
|
@@ -519,53 +506,8 @@ CarouselCards.args = {
|
|
|
519
506
|
},
|
|
520
507
|
],
|
|
521
508
|
},
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
title: "State of Europe's environment",
|
|
525
|
-
meta: 'March 20, 2022.',
|
|
526
|
-
imgUrl:
|
|
527
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
528
|
-
hasImage: true,
|
|
529
|
-
href: '/#',
|
|
530
|
-
fluid: true,
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
title: 'Nature',
|
|
534
|
-
meta: 'March 20, 2022.',
|
|
535
|
-
imgUrl:
|
|
536
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
537
|
-
hasImage: true,
|
|
538
|
-
href: '/#',
|
|
539
|
-
fluid: true,
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
title: 'Health',
|
|
543
|
-
meta: 'March 20, 2022.',
|
|
544
|
-
imgUrl:
|
|
545
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
546
|
-
hasImage: true,
|
|
547
|
-
href: '/#',
|
|
548
|
-
fluid: true,
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
title: 'Climate',
|
|
552
|
-
meta: 'March 20, 2022.',
|
|
553
|
-
imgUrl:
|
|
554
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
555
|
-
hasImage: true,
|
|
556
|
-
href: '/#',
|
|
557
|
-
fluid: true,
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
title: 'Economy and resources',
|
|
561
|
-
meta: 'March 20, 2022.',
|
|
562
|
-
imgUrl:
|
|
563
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
564
|
-
hasImage: true,
|
|
565
|
-
href: '/#',
|
|
566
|
-
fluid: true,
|
|
567
|
-
},
|
|
568
|
-
],
|
|
509
|
+
numberOfCards: 5,
|
|
510
|
+
cards: [...cardModels],
|
|
569
511
|
};
|
|
570
512
|
CarouselCards.argTypes = {
|
|
571
513
|
settings: {
|
|
@@ -587,6 +529,7 @@ const TeaserCard = ({
|
|
|
587
529
|
objectFit,
|
|
588
530
|
objectPosition,
|
|
589
531
|
titleMaxLines,
|
|
532
|
+
fluid,
|
|
590
533
|
maxLines,
|
|
591
534
|
card,
|
|
592
535
|
}) => (
|
|
@@ -595,7 +538,7 @@ const TeaserCard = ({
|
|
|
595
538
|
className={`styled-teaser styled ${variant === 'default' ? '' : variant}`}
|
|
596
539
|
>
|
|
597
540
|
<div
|
|
598
|
-
className={`ui card u-card ${
|
|
541
|
+
className={`ui card u-card ${fluid ? 'fluid' : ''} ${
|
|
599
542
|
inverted ? 'inverted' : ''
|
|
600
543
|
} ${variant} ${rounded ? 'rounded' : ''} ${
|
|
601
544
|
objectFit === 'unset' ? '' : 'has--object-fit--' + objectFit
|
|
@@ -633,28 +576,28 @@ const TeaserCard = ({
|
|
|
633
576
|
</div>
|
|
634
577
|
);
|
|
635
578
|
|
|
636
|
-
const TeaserTemplate = (args) =>
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
key={index}
|
|
652
|
-
|
|
653
|
-
|
|
579
|
+
const TeaserTemplate = (args) => {
|
|
580
|
+
const columnCount = { 1: 'one', 2: 'two', 3: 'three', 4: 'four' };
|
|
581
|
+
return (
|
|
582
|
+
<Container>
|
|
583
|
+
<div
|
|
584
|
+
className={`block __grid teaserGrid centered ${
|
|
585
|
+
columnCount[args.numberOfCards]
|
|
586
|
+
}`}
|
|
587
|
+
>
|
|
588
|
+
<div
|
|
589
|
+
className={`ui stackable stretched ${
|
|
590
|
+
columnCount[args.numberOfCards]
|
|
591
|
+
} column grid`}
|
|
592
|
+
>
|
|
593
|
+
{args.cards.slice(0, args.numberOfCards).map((card, index) => (
|
|
594
|
+
<TeaserCard {...args} card={card} key={index} />
|
|
595
|
+
))}
|
|
596
|
+
</div>
|
|
654
597
|
</div>
|
|
655
|
-
</
|
|
656
|
-
|
|
657
|
-
|
|
598
|
+
</Container>
|
|
599
|
+
);
|
|
600
|
+
};
|
|
658
601
|
|
|
659
602
|
export const TeaserCardGrid = TeaserTemplate.bind({});
|
|
660
603
|
TeaserCardGrid.args = {
|
|
@@ -666,36 +609,7 @@ TeaserCardGrid.args = {
|
|
|
666
609
|
objectPosition: 'center',
|
|
667
610
|
titleMaxLines: '2',
|
|
668
611
|
maxLines: '2',
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
imgUrl:
|
|
673
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
674
|
-
description:
|
|
675
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
676
|
-
hasImage: true,
|
|
677
|
-
href: '/#',
|
|
678
|
-
fluid: true,
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
title: 'Climate',
|
|
682
|
-
imgUrl:
|
|
683
|
-
'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
|
|
684
|
-
hasImage: true,
|
|
685
|
-
description:
|
|
686
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
687
|
-
href: '/#',
|
|
688
|
-
fluid: true,
|
|
689
|
-
},
|
|
690
|
-
{
|
|
691
|
-
title: 'Economy and resources',
|
|
692
|
-
imgUrl:
|
|
693
|
-
'https://www.eea.europa.eu/media/pictures/european-environment-agency-building-with/image_large',
|
|
694
|
-
hasImage: true,
|
|
695
|
-
description:
|
|
696
|
-
'Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.Leo fermentum sollicitudin suspendisse iaculis feugiat. Eget tellus blandit aenean mattis.',
|
|
697
|
-
href: '/#',
|
|
698
|
-
fluid: true,
|
|
699
|
-
},
|
|
700
|
-
],
|
|
612
|
+
fluid: true,
|
|
613
|
+
numberOfCards: 3,
|
|
614
|
+
cards: [...cardModels],
|
|
701
615
|
};
|