@eeacms/volto-eea-design-system 1.19.0 → 1.20.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/package.json +3 -3
  3. package/src/ui/Card/Card.stories.jsx +104 -50
  4. package/src/ui/Card/Card.stories.test.jsx +196 -0
  5. package/src/ui/Header/Header.stories.js +14 -10
  6. package/src/ui/Tab/Tab.stories.js +21 -5
  7. package/src/ui/Tab/Tab.stories.test.js +10 -0
  8. package/theme/themes/eea/collections/breadcrumb.overrides +4 -3
  9. package/theme/themes/eea/collections/menu.overrides +201 -15
  10. package/theme/themes/eea/collections/menu.variables +43 -28
  11. package/theme/themes/eea/collections/message.overrides +1 -1
  12. package/theme/themes/eea/collections/table.overrides +9 -15
  13. package/theme/themes/eea/elements/button.overrides +2 -2
  14. package/theme/themes/eea/elements/container.overrides +39 -34
  15. package/theme/themes/eea/elements/divider.overrides +13 -9
  16. package/theme/themes/eea/elements/image.overrides +5 -6
  17. package/theme/themes/eea/elements/label.overrides +16 -16
  18. package/theme/themes/eea/elements/list.overrides +3 -1
  19. package/theme/themes/eea/elements/segment.overrides +4 -4
  20. package/theme/themes/eea/extras/custom.overrides +43 -22
  21. package/theme/themes/eea/globals/site.overrides +63 -35
  22. package/theme/themes/eea/globals/site.variables +2 -5
  23. package/theme/themes/eea/modules/accordion.overrides +36 -24
  24. package/theme/themes/eea/modules/accordion.variables +4 -4
  25. package/theme/themes/eea/modules/checkbox.overrides +2 -2
  26. package/theme/themes/eea/modules/modal.overrides +2 -2
  27. package/theme/themes/eea/modules/search.overrides +4 -0
  28. package/theme/themes/eea/modules/tab.overrides +6 -12
  29. package/theme/themes/eea/modules/tab.variables +2 -1
  30. package/theme/themes/eea/tokens/colors.less +2 -2
  31. package/theme/themes/eea/views/card.overrides +49 -35
  32. package/theme/themes/eea/views/card.variables +5 -0
  33. package/theme/themes/eea/views/item.overrides +11 -9
  34. package/theme/themes/eea/views/statistic.overrides +13 -3
package/CHANGELOG.md CHANGED
@@ -4,6 +4,67 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.20.0](https://github.com/eea/volto-eea-design-system/compare/1.19.0...1.20.0) - 1 November 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(storybook): add event date on cards based on volto-listing-block; refs #258288 #402 from eea/cards-storybook [ichim-david - [`638241c`](https://github.com/eea/volto-eea-design-system/commit/638241cd8376dba9970c415fce5b46c93dde48da)]
12
+ - feat(accordion): accordion title now has css variable for justification and icon order [David Ichim - [`cd775de`](https://github.com/eea/volto-eea-design-system/commit/cd775de9a347b2999cfa378da947bac2076df460)]
13
+ - feat(tabs): added inverted option to tabs storybook [David Ichim - [`d9e760b`](https://github.com/eea/volto-eea-design-system/commit/d9e760b069a48a7a4594c6dba0044755415d505d)]
14
+ - feat(tabs): added theme config to tabs storybook [David Ichim - [`01d1e85`](https://github.com/eea/volto-eea-design-system/commit/01d1e85b82b18cae7ac6519f86e471149c210e73)]
15
+ - feat(tabs): allow styling of vertical tabs with and without secondary or pointing classes [David Ichim - [`1d1b78b`](https://github.com/eea/volto-eea-design-system/commit/1d1b78ba22bbf63c02f7db0d4a8b5a1dd309f755)]
16
+ - feat(tabs): style tabs for themes without need of secondary and pointing classes [David Ichim - [`2337659`](https://github.com/eea/volto-eea-design-system/commit/233765947f2653b6dd6bf91e85a2c09deb5af5a6)]
17
+ - feat(accordion): style inverted theme version to set bg color to theme color [David Ichim - [`ab1e8df`](https://github.com/eea/volto-eea-design-system/commit/ab1e8df9ea5911a70ee45212213eac4fe0d3611d)]
18
+
19
+ #### :bug: Bug Fixes
20
+
21
+ - fix(item): position of text when icon is on top to align on center [David Ichim - [`ce37114`](https://github.com/eea/volto-eea-design-system/commit/ce37114c97f29884080747a4691031ffd66d2ab5)]
22
+ - fix: Fix page layout on edit view when a block has full-with size; Refs #259212 #405 from eea/full-width-edit-mode [ichim-david - [`36820f5`](https://github.com/eea/volto-eea-design-system/commit/36820f5252992eecb27b3a4b5a87a74df6d2c274)]
23
+ - fix: Fix page layout on edit view when a block has full-with size; Refs #259212 [kreafox - [`16c9a55`](https://github.com/eea/volto-eea-design-system/commit/16c9a558118fd312688a8aa8dee6ee2f474664a5)]
24
+ - fix: formatting (stylelint) [kreafox - [`ba35c2e`](https://github.com/eea/volto-eea-design-system/commit/ba35c2e000aa7443670de32f212af3e0c93f5576)]
25
+ - fix: redo changes [kreafox - [`101e957`](https://github.com/eea/volto-eea-design-system/commit/101e95777a40a1c8b3958c90c7f3a44152a48f7c)]
26
+ - fix: Fix page layout on edit view when a block has full-with size; Refs #259212 [kreafox - [`55617e6`](https://github.com/eea/volto-eea-design-system/commit/55617e6ec9ce4930e97fe4a886cbdd36c1bb3941)]
27
+ - fix(accordion): color change of sub accordions due to theme settings on parent [David Ichim - [`f3755ac`](https://github.com/eea/volto-eea-design-system/commit/f3755ac9ffcc5ba5ed9992fbab8fbd5f69dc92ba)]
28
+ - fix(block-chooser): title block order and color because it receives styling from accordion title styles [David Ichim - [`ecc85b2`](https://github.com/eea/volto-eea-design-system/commit/ecc85b2e1fa9bd6809dabf4655afe785e1085473)]
29
+ - fix(tabs): edit active tab background color [David Ichim - [`c5726a4`](https://github.com/eea/volto-eea-design-system/commit/c5726a467a39592415dae2a7e40616cf5a9a0bbf)]
30
+
31
+ #### :nail_care: Enhancements
32
+
33
+ - change(storybook): add event date on cards based on volto-listing-block; refs #258288 [kreafox - [`25af204`](https://github.com/eea/volto-eea-design-system/commit/25af204d81c4253c5ca6705b47a893c3f3443cc3)]
34
+ - change(tabs): modified logic for left and right tabs to work without secondary and pointing [David Ichim - [`ac60bc0`](https://github.com/eea/volto-eea-design-system/commit/ac60bc0a282da41fdc36792275807e7625a11076)]
35
+ - change(tabs): vertical menu gets same item size as themes without borders or shadows [David Ichim - [`f2b49ec`](https://github.com/eea/volto-eea-design-system/commit/f2b49ec3bc4358f33f134230f91c18fe36bc95ef)]
36
+
37
+ #### :house: Internal changes
38
+
39
+ - chore: husky, lint-staged use fixed versions [valentinab25 - [`59ecb8e`](https://github.com/eea/volto-eea-design-system/commit/59ecb8e28b259472303324f9655b0cbbcbbf9c23)]
40
+
41
+ #### :hammer_and_wrench: Others
42
+
43
+ - bump package version preparing for release [David Ichim - [`c3bddab`](https://github.com/eea/volto-eea-design-system/commit/c3bddab1d2aa18b0cc2b1b4d5d9d8a4e437e6e07)]
44
+ - fixed missing comma from accordion selector [David Ichim - [`609f676`](https://github.com/eea/volto-eea-design-system/commit/609f67627c500d5e1d7714d4eb5598f78aafe90d)]
45
+ - prettier and stylelint fix commands [David Ichim - [`82ec097`](https://github.com/eea/volto-eea-design-system/commit/82ec097016b4d3ba06d36ae473151d636b00be6a)]
46
+ - style tabs with situations where we have secondary plus theme classes [David Ichim - [`41ee835`](https://github.com/eea/volto-eea-design-system/commit/41ee8353a43b25095d01c63a3bf9895ab7601b68)]
47
+ - Added color for inverted active menu [David Ichim - [`457e223`](https://github.com/eea/volto-eea-design-system/commit/457e223dc5a45ae5173fcdd239b89f2cbcc48942)]
48
+ - Added correct color for tab brown option [David Ichim - [`a4e58fe`](https://github.com/eea/volto-eea-design-system/commit/a4e58fefdfb5b35168bf8e514f8c1c1661d46288)]
49
+ - Style inverted secondary menu using css variables: [David Ichim - [`d3a8d7c`](https://github.com/eea/volto-eea-design-system/commit/d3a8d7c65472f9abcc93ccbe13b2c9ca5634266f)]
50
+ - make accordion transformed from rrt_tabs use same color bg as tabs [David Ichim - [`3a1a144`](https://github.com/eea/volto-eea-design-system/commit/3a1a144e5ec1a936db9caa8c1f39af4db4dd7c72)]
51
+ - Tabs to accordion transformation for volto-tabs-block accordion template #256605 #392 from eea/tabs-accordion-transformation-256605 [ichim-david - [`cf7d1ef`](https://github.com/eea/volto-eea-design-system/commit/cf7d1ef6200c898c86598ba7e4a225180faa9537)]
52
+ - test(Card): fix duplicated lines reported by sonarqube [kreafox - [`ef1fc33`](https://github.com/eea/volto-eea-design-system/commit/ef1fc337855049364d7fdc10621c8f4c376815f5)]
53
+ - test(Card): add missing tests for ImageGrid [kreafox - [`5971e01`](https://github.com/eea/volto-eea-design-system/commit/5971e01a2f4f5ba8a180ed2fd38df28d55ad92c0)]
54
+ - test(Card): add Card tests to check correct rendering [kreafox - [`1de5f50`](https://github.com/eea/volto-eea-design-system/commit/1de5f5065a0fa10a931b57fcc4f7831427f897cf)]
55
+ - inverted border should be transparent black instead of black [David Ichim - [`700b9e7`](https://github.com/eea/volto-eea-design-system/commit/700b9e7abef32d5721ea093baa122d8cd4eb5e1b)]
56
+ - implement colors for tabs when using the inverted option, and we still secondary or pointing [David Ichim - [`e3e5fef`](https://github.com/eea/volto-eea-design-system/commit/e3e5fef006ce6ad5dd144a9fb6b8054be9a2a50c)]
57
+ - fix text bounce when using normal tabs due to border size and negative border margin [David Ichim - [`10b7241`](https://github.com/eea/volto-eea-design-system/commit/10b72418ecdf16690eaec229d406969b0eb31336)]
58
+ - Rollback previous change as passing items shorthand does not add ui class [David Ichim - [`ce36c78`](https://github.com/eea/volto-eea-design-system/commit/ce36c789c9289698d7e8a2c0ab54d364a0909b07)]
59
+ - stylelint fix [David Ichim - [`fd4831e`](https://github.com/eea/volto-eea-design-system/commit/fd4831ef31b70bcad8f8b3c49a14b47e857e5e36)]
60
+ - Removed pointing option from vertical tab by default: [David Ichim - [`19d1870`](https://github.com/eea/volto-eea-design-system/commit/19d187037a8aa7d5e2c8dfb518ebf3941d24839f)]
61
+ - fixed color of input within edit page when double-clicking to edit the tab name [David Ichim - [`957e6fd`](https://github.com/eea/volto-eea-design-system/commit/957e6fd5eba3d7b35b8b1a16dbbcef9d732c4e35)]
62
+ - modify tabs story for vertical to still make use of pointing param [David Ichim - [`6963345`](https://github.com/eea/volto-eea-design-system/commit/6963345702c08dd6e1e68dcbf067c9a9ff1502a1)]
63
+ - style tabs menu items for any themes without assumption of pointing or secondary class being present [David Ichim - [`6278457`](https://github.com/eea/volto-eea-design-system/commit/6278457324f7fc4b2c40bdc8c38af708d3950707)]
64
+ - fix test [Dobricean Ioan Dorian - [`6d6e3b9`](https://github.com/eea/volto-eea-design-system/commit/6d6e3b9fa83665dbdff206f0a8e5530c1a128ffe)]
65
+ - add jest test [Dobricean Ioan Dorian - [`cc9533c`](https://github.com/eea/volto-eea-design-system/commit/cc9533c41ef985d394be6b9bb5c776d03a37993c)]
66
+ - add styles for tabs [Dobricean Ioan Dorian - [`8448bf4`](https://github.com/eea/volto-eea-design-system/commit/8448bf4ed60b18a9a28e6e5ef4451fefc141d263)]
67
+ - wip modifying menu classes so that we can use css variables for tab menus [David Ichim - [`f8a55c5`](https://github.com/eea/volto-eea-design-system/commit/f8a55c5ab059de53b66db2f8233fac068d3c96b0)]
7
68
  ### [1.19.0](https://github.com/eea/volto-eea-design-system/compare/1.18.3...1.19.0) - 13 October 2023
8
69
 
9
70
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "@eeacms/volto-eea-design-system: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -32,8 +32,8 @@
32
32
  "@cypress/code-coverage": "^3.10.0",
33
33
  "@plone/scripts": "*",
34
34
  "babel-plugin-transform-class-properties": "^6.24.1",
35
- "husky": "*",
36
- "lint-staged": "*",
35
+ "husky": "^8.0.3",
36
+ "lint-staged": "^14.0.1",
37
37
  "md5": "^2.3.0"
38
38
  },
39
39
  "lint-staged": {
@@ -8,72 +8,90 @@ 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, ' +
11
+ const createCardModel = (
12
+ title,
13
+ imgUrl,
14
+ description,
15
+ meta,
16
+ metaRight,
17
+ eventDate,
18
+ href,
19
+ ) => {
20
+ return {
21
+ title: title,
22
+ imgUrl: imgUrl,
23
+ description: description,
24
+ meta: meta,
25
+ metaRight: metaRight,
26
+ eventDate: eventDate,
27
+ href: href,
28
+ };
29
+ };
30
+
31
+ const cardData = [
32
+ [
33
+ 'Economy and resources',
34
+ 'https://www.eea.europa.eu/publications/eea-eionet-strategy-2021-2030/image_mini',
35
+ 'The economy plays a vital role in our lives by providing access to employment, ' +
18
36
  'products and services that help us thrive. Unfortunately, with its key sectors like agriculture,' +
19
37
  ' energy and transport, our economy also harms the environment and causes climate change. ' +
20
38
  '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, ' +
39
+ 'Article',
40
+ '20/05/2022',
41
+ '15/10/2023',
42
+ '/#',
43
+ ],
44
+ [
45
+ 'Health',
46
+ 'https://www.eea.europa.eu/en/topics/at-a-glance/health/@@images/image/preview',
47
+ 'By improving air, water, and soil quality and limiting pollution released to nature, ' +
31
48
  'the EU has significantly contributed to enhancing human health in the last five ' +
32
49
  'decades. Yet, many vulnerable groups continue to be impacted by environmental ' +
33
50
  'degradation and climate change. Further improvements can help keep Europeans ' +
34
51
  '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 ' +
52
+ 'Article',
53
+ '30/06/2023',
54
+ '03/08/2023',
55
+ '/#',
56
+ ],
57
+ [
58
+ 'Nature',
59
+ 'https://www.eea.europa.eu/en/topics/at-a-glance/nature/@@images/image/preview',
60
+ "Europe's nature is filled with forests, mountains, vast plains, long rivers, deep blue seas and " +
45
61
  'refreshing lakes. But it also is under threat. Unsustainable farming and forestry practices, ' +
46
62
  'pollution, climate change and invasive species are stressing and destabilising all natural ' +
47
63
  '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 ' +
64
+ 'Article',
65
+ '10/04/2022',
66
+ '18/05/2023',
67
+ '/#',
68
+ ],
69
+ [
70
+ 'Climate',
71
+ 'https://www.eea.europa.eu/en/topics/at-a-glance/climate/@@images/image/preview',
72
+ 'Climate change affects us all and is accelerating. Its impacts will become even more severe if ' +
59
73
  'the increase in global temperature is not kept below 1.5°C. The EU and its Member States are ' +
60
74
  '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 ' +
75
+ 'Article',
76
+ '20/06/2022',
77
+ '15/03/2024',
78
+ '/#',
79
+ ],
80
+ [
81
+ "State of Europe's environment",
82
+ 'https://www.eea.europa.eu/en/topics/at-a-glance/state-of-europes-environment/@@images/image/preview',
83
+ 'EU environment and climate policies have delivered substantial benefits over recent ' +
69
84
  'decades, such as cleaner air and water. Nevertheless, Europe, as well as the rest ' +
70
85
  'of the globe, is facing environmental challenges of unprecedented scale and urgency.',
71
- meta: 'Article',
72
- metaRight: '16/03/2022',
73
- href: '/#',
74
- },
86
+ 'Article',
87
+ '16/03/2022',
88
+ '13/01/2024',
89
+ '/#',
90
+ ],
75
91
  ];
76
92
 
93
+ const cardModels = cardData.map((card) => createCardModel(...card));
94
+
77
95
  export default {
78
96
  title: 'Components/Card/Default',
79
97
  component: Card,
@@ -166,6 +184,15 @@ export default {
166
184
  defaultValue: { summary: '2' },
167
185
  },
168
186
  },
187
+ eventDate: {
188
+ name: 'Event date',
189
+ control: { type: 'boolean' },
190
+ table: {
191
+ category: 'Content',
192
+ defaultValue: { summary: 'false' },
193
+ type: { summary: 'boolean' },
194
+ },
195
+ },
169
196
  cards: {
170
197
  name: 'Cards content',
171
198
  table: {
@@ -192,6 +219,17 @@ const MetaRight = (args) => (
192
219
  <span className="bold text-right">{args.metaRight}</span>
193
220
  );
194
221
 
222
+ const EventDate = (args) => (
223
+ <>
224
+ {args.eventDate && (
225
+ <span className="event-date">
226
+ <Icon className="ri-calendar-line" />
227
+ <span>{args.eventDate}</span>
228
+ </span>
229
+ )}
230
+ </>
231
+ );
232
+
195
233
  const CardTemplate = ({
196
234
  variant,
197
235
  inverted,
@@ -201,6 +239,7 @@ const CardTemplate = ({
201
239
  objectPosition,
202
240
  titleMaxLines,
203
241
  maxLines,
242
+ eventDate,
204
243
  fluid,
205
244
  card,
206
245
  }) => (
@@ -244,6 +283,9 @@ const CardTemplate = ({
244
283
  ''
245
284
  )}
246
285
 
286
+ {/* Event date */}
287
+ {eventDate && <EventDate {...card} />}
288
+
247
289
  {/* Description */}
248
290
  <Card.Description>{card.description}</Card.Description>
249
291
  </Card.Content>
@@ -276,6 +318,7 @@ Default.args = {
276
318
  objectPosition: 'center',
277
319
  titleMaxLines: '2',
278
320
  maxLines: '2',
321
+ eventDate: false,
279
322
  numberOfCards: 1,
280
323
  fluid: false,
281
324
  cards: [...cardModels],
@@ -302,6 +345,7 @@ CardGrid.args = {
302
345
  objectPosition: 'center',
303
346
  titleMaxLines: '2',
304
347
  maxLines: '2',
348
+ eventDate: false,
305
349
  fluid: true,
306
350
  numberOfCards: 5,
307
351
  cards: [...cardModels],
@@ -363,6 +407,11 @@ ImageGrid.argTypes = {
363
407
  disable: true,
364
408
  },
365
409
  },
410
+ eventDate: {
411
+ table: {
412
+ disable: true,
413
+ },
414
+ },
366
415
  maxLines: {
367
416
  table: {
368
417
  disable: true,
@@ -391,6 +440,7 @@ FluidGrid.args = {
391
440
  titleMaxLines: '2',
392
441
  maxLines: '2',
393
442
  numberOfCards: 3,
443
+ eventDate: false,
394
444
  fluid: true,
395
445
  cards: [...cardModels],
396
446
  };
@@ -481,6 +531,7 @@ CarouselCards.args = {
481
531
  objectPosition: 'center',
482
532
  titleMaxLines: '2',
483
533
  maxLines: '2',
534
+ eventDate: false,
484
535
  fluid: true,
485
536
  settings: {
486
537
  dots: true,
@@ -534,6 +585,7 @@ const TeaserCard = ({
534
585
  titleMaxLines,
535
586
  fluid,
536
587
  maxLines,
588
+ eventDate,
537
589
  card,
538
590
  }) => (
539
591
  <div className="column grid-block-teaser">
@@ -571,6 +623,7 @@ const TeaserCard = ({
571
623
  <div className="header">
572
624
  <a href={card.href}>{card.title}</a>
573
625
  </div>
626
+ {eventDate && <EventDate {...card} />}
574
627
  <Card.Description>{card.description}</Card.Description>
575
628
  </div>
576
629
  )}
@@ -612,6 +665,7 @@ TeaserCardGrid.args = {
612
665
  objectPosition: 'center',
613
666
  titleMaxLines: '2',
614
667
  maxLines: '2',
668
+ eventDate: false,
615
669
  fluid: true,
616
670
  numberOfCards: 3,
617
671
  cards: [...cardModels],
@@ -1,14 +1,48 @@
1
1
  import React from 'react';
2
2
  import { render, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
3
4
  import {
4
5
  TeaserCardGrid,
5
6
  CarouselCards,
6
7
  FluidGrid,
7
8
  CardGrid,
9
+ ImageGrid,
8
10
  Default,
9
11
  } from './Card.stories';
10
12
 
11
13
  describe('TeaserCardGrid component', () => {
14
+ it('renders correctly', () => {
15
+ const { container } = render(<TeaserCardGrid {...TeaserCardGrid.args} />);
16
+
17
+ expect(container.querySelector('.image')).toBeInTheDocument();
18
+ expect(container.querySelector('.header')).toBeInTheDocument();
19
+ expect(container.querySelector('.description')).toBeInTheDocument();
20
+
21
+ expect(
22
+ container.querySelector(`.ui.card.u-card.${TeaserCardGrid.args.variant}`),
23
+ ).toBeInTheDocument();
24
+ expect(
25
+ container.querySelector(
26
+ `.ui.card.u-card.max-${TeaserCardGrid.args.maxLines}-lines`,
27
+ ),
28
+ ).toBeInTheDocument();
29
+ expect(
30
+ container.querySelector(
31
+ `.ui.card.u-card.title-max-${TeaserCardGrid.args.maxLines}-lines`,
32
+ ),
33
+ ).toBeInTheDocument();
34
+ expect(
35
+ container.querySelector(
36
+ `.ui.card.u-card.has--object-fit--${TeaserCardGrid.args.objectFit}`,
37
+ ),
38
+ ).toBeInTheDocument();
39
+ expect(
40
+ container.querySelector(
41
+ `.ui.card.u-card.has--object-position--${TeaserCardGrid.args.objectPosition}`,
42
+ ),
43
+ ).toBeInTheDocument();
44
+ });
45
+
12
46
  it('renders the teaser card grid with correct number of cards', () => {
13
47
  const { container } = render(<TeaserCardGrid {...TeaserCardGrid.args} />);
14
48
  const teaserCards = container.querySelectorAll('.column.grid-block-teaser');
@@ -26,6 +60,39 @@ describe('TeaserCardGrid component', () => {
26
60
  });
27
61
 
28
62
  describe('CarouselCards component', () => {
63
+ it('renders correctly', () => {
64
+ const { container } = render(<CarouselCards {...CarouselCards.args} />);
65
+
66
+ expect(container.querySelector('.image')).toBeInTheDocument();
67
+ expect(container.querySelector('.header')).toBeInTheDocument();
68
+ expect(container.querySelector('.meta')).toBeInTheDocument();
69
+ expect(container.querySelector('.description')).toBeInTheDocument();
70
+
71
+ expect(
72
+ container.querySelector(`.ui.card.u-card.${CarouselCards.args.variant}`),
73
+ ).toBeInTheDocument();
74
+ expect(
75
+ container.querySelector(
76
+ `.ui.card.u-card.max-${CarouselCards.args.maxLines}-lines`,
77
+ ),
78
+ ).toBeInTheDocument();
79
+ expect(
80
+ container.querySelector(
81
+ `.ui.card.u-card.title-max-${CarouselCards.args.maxLines}-lines`,
82
+ ),
83
+ ).toBeInTheDocument();
84
+ expect(
85
+ container.querySelector(
86
+ `.ui.card.u-card.has--object-fit--${CarouselCards.args.objectFit}`,
87
+ ),
88
+ ).toBeInTheDocument();
89
+ expect(
90
+ container.querySelector(
91
+ `.ui.card.u-card.has--object-position--${CarouselCards.args.objectPosition}`,
92
+ ),
93
+ ).toBeInTheDocument();
94
+ });
95
+
29
96
  it('renders the carousel with correct number of cards', () => {
30
97
  const { container } = render(<CarouselCards {...CarouselCards.args} />);
31
98
  const carouselCards = container.querySelectorAll(
@@ -47,6 +114,39 @@ describe('CarouselCards component', () => {
47
114
  });
48
115
 
49
116
  describe('FluidGrid component', () => {
117
+ it('renders correctly', () => {
118
+ const { container } = render(<FluidGrid {...FluidGrid.args} />);
119
+
120
+ expect(container.querySelector('.image')).toBeInTheDocument();
121
+ expect(container.querySelector('.header')).toBeInTheDocument();
122
+ expect(container.querySelector('.meta')).toBeInTheDocument();
123
+ expect(container.querySelector('.description')).toBeInTheDocument();
124
+
125
+ expect(
126
+ container.querySelector(`.ui.card.u-card.${FluidGrid.args.variant}`),
127
+ ).toBeInTheDocument();
128
+ expect(
129
+ container.querySelector(
130
+ `.ui.card.u-card.max-${FluidGrid.args.maxLines}-lines`,
131
+ ),
132
+ ).toBeInTheDocument();
133
+ expect(
134
+ container.querySelector(
135
+ `.ui.card.u-card.title-max-${FluidGrid.args.maxLines}-lines`,
136
+ ),
137
+ ).toBeInTheDocument();
138
+ expect(
139
+ container.querySelector(
140
+ `.ui.card.u-card.has--object-fit--${FluidGrid.args.objectFit}`,
141
+ ),
142
+ ).toBeInTheDocument();
143
+ expect(
144
+ container.querySelector(
145
+ `.ui.card.u-card.has--object-position--${FluidGrid.args.objectPosition}`,
146
+ ),
147
+ ).toBeInTheDocument();
148
+ });
149
+
50
150
  it('renders fluid grid with correct number of cards', () => {
51
151
  const { container } = render(<FluidGrid {...FluidGrid.args} />);
52
152
  const fluidGridCards = container.querySelectorAll(
@@ -58,6 +158,39 @@ describe('FluidGrid component', () => {
58
158
  });
59
159
 
60
160
  describe('CardGrid component', () => {
161
+ it('renders correctly', () => {
162
+ const { container } = render(<CardGrid {...CardGrid.args} />);
163
+
164
+ expect(container.querySelector('.image')).toBeInTheDocument();
165
+ expect(container.querySelector('.header')).toBeInTheDocument();
166
+ expect(container.querySelector('.meta')).toBeInTheDocument();
167
+ expect(container.querySelector('.description')).toBeInTheDocument();
168
+
169
+ expect(
170
+ container.querySelector(`.ui.card.u-card.${CardGrid.args.variant}`),
171
+ ).toBeInTheDocument();
172
+ expect(
173
+ container.querySelector(
174
+ `.ui.card.u-card.max-${CardGrid.args.maxLines}-lines`,
175
+ ),
176
+ ).toBeInTheDocument();
177
+ expect(
178
+ container.querySelector(
179
+ `.ui.card.u-card.title-max-${CardGrid.args.maxLines}-lines`,
180
+ ),
181
+ ).toBeInTheDocument();
182
+ expect(
183
+ container.querySelector(
184
+ `.ui.card.u-card.has--object-fit--${CardGrid.args.objectFit}`,
185
+ ),
186
+ ).toBeInTheDocument();
187
+ expect(
188
+ container.querySelector(
189
+ `.ui.card.u-card.has--object-position--${CardGrid.args.objectPosition}`,
190
+ ),
191
+ ).toBeInTheDocument();
192
+ });
193
+
61
194
  it('renders the card grid with correct number of cards', () => {
62
195
  const { container } = render(<CardGrid {...CardGrid.args} />);
63
196
  const cardGridCards = container.querySelectorAll(
@@ -67,7 +200,70 @@ describe('CardGrid component', () => {
67
200
  });
68
201
  });
69
202
 
203
+ describe('ImageGrid component', () => {
204
+ it('renders correctly', () => {
205
+ const { container } = render(<ImageGrid {...ImageGrid.args} />);
206
+
207
+ expect(container.querySelector('.ui.image')).toBeInTheDocument();
208
+
209
+ expect(
210
+ container.querySelector(`.ui.card.u-card.${ImageGrid.args.variant}`),
211
+ ).toBeInTheDocument();
212
+ expect(
213
+ container.querySelector(
214
+ `.ui.card.u-card.has--object-fit--${ImageGrid.args.objectFit}`,
215
+ ),
216
+ ).toBeInTheDocument();
217
+ expect(
218
+ container.querySelector(
219
+ `.ui.card.u-card.has--object-position--${ImageGrid.args.objectPosition}`,
220
+ ),
221
+ ).toBeInTheDocument();
222
+ });
223
+
224
+ it('renders the image grid with correct number of cards', () => {
225
+ const { container } = render(<ImageGrid {...ImageGrid.args} />);
226
+ const imageGridCards = container.querySelectorAll(
227
+ '.ui.card.u-card.default .ui.image',
228
+ );
229
+ expect(imageGridCards.length).toBe(5);
230
+ });
231
+ });
232
+
70
233
  describe('Default component', () => {
234
+ it('renders correctly', () => {
235
+ const { container } = render(<Default {...Default.args} />);
236
+
237
+ expect(container.querySelector('.image')).toBeInTheDocument();
238
+ expect(container.querySelector('.header')).toBeInTheDocument();
239
+ expect(container.querySelector('.meta')).toBeInTheDocument();
240
+ expect(container.querySelector('.description')).toBeInTheDocument();
241
+
242
+ expect(
243
+ container.querySelector(`.ui.card.u-card.${Default.args.variant}`),
244
+ ).toBeInTheDocument();
245
+ expect(
246
+ container.querySelector(
247
+ `.ui.card.u-card.max-${Default.args.maxLines}-lines`,
248
+ ),
249
+ ).toBeInTheDocument();
250
+ expect(
251
+ container.querySelector(
252
+ `.ui.card.u-card.title-max-${Default.args.maxLines}-lines`,
253
+ ),
254
+ ).toBeInTheDocument();
255
+ expect(
256
+ container.querySelector(
257
+ `.ui.card.u-card.has--object-fit--${Default.args.objectFit}`,
258
+ ),
259
+ ).toBeInTheDocument();
260
+ expect(
261
+ container.querySelector(
262
+ `.ui.card.u-card.has--object-position--${Default.args.objectPosition}`,
263
+ ),
264
+ ).toBeInTheDocument();
265
+ });
266
+
71
267
  it('renders the default with correct number of cards', () => {
72
268
  const { container } = render(<Default {...Default.args} />);
73
269
  const defaultCards = container.querySelectorAll(
@@ -58,16 +58,20 @@ const logoProps = {
58
58
  };
59
59
 
60
60
  const links = [
61
- { title: 'EEA Main Portal', href: '/#' },
62
- { title: 'Biodiversity Information System for Europe', href: '/#' },
63
- { title: 'Climate Adaptation Platform', href: '/#' },
64
- { title: 'Copernicus in situ component', href: '/#' },
65
- { title: 'Copernicus land monitoring', href: '/#' },
61
+ { title: 'European Environment Agency website', href: '/#' },
62
+ { title: 'WISE marine - Marine information system for Europe', href: '/#' },
63
+ {
64
+ title: 'WISE freshwater - Freshwater information system for Europe',
65
+ href: '/#',
66
+ },
67
+ { title: 'BISE - Biodiversity information system for Europe', href: '/#' },
68
+ { title: 'FISE - Forest information system for Europe', href: '/#' },
69
+ { title: 'European Climate and health observatory', href: '/#' },
70
+ { title: 'ClimateADAPT', href: '/#' },
66
71
  { title: 'European Industrial Emissions Portal', href: '/#' },
67
- { title: 'Forest Information System for Europe', href: '/#' },
68
- { title: 'Information Platform for Chemical Monitoring', href: '/#' },
69
- { title: 'Marine Water Information System for Europe', href: '/#' },
70
- { title: 'Fresh Water Information System for Europe', href: '/#' },
72
+ { title: 'Climate and Energy in the EU', href: '/#' },
73
+ { title: 'Copernicus Land Monitoring Service', href: '/#' },
74
+ { title: 'Copernicus InSitu', href: '/#' },
71
75
  ];
72
76
 
73
77
  const languages = [
@@ -1234,7 +1238,7 @@ const Template = (args) => {
1234
1238
  <Header>
1235
1239
  <Header.TopHeader>
1236
1240
  <Header.TopItem className="official-union">
1237
- <Image src={eeaFlag} alt="eea flag"></Image>
1241
+ <Image src={eeaFlag} alt="European Union flag"></Image>
1238
1242
  <Header.TopDropdownMenu
1239
1243
  text="An official website of the European Union | How do you know?"
1240
1244
  tabletText="An official website of the European Union"