@eeacms/volto-eea-design-system 1.19.0 → 1.21.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 (52) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/cypress.config.js +3 -3
  3. package/package.json +3 -3
  4. package/src/ui/Banner/Banner.jsx +7 -13
  5. package/src/ui/Card/Card.stories.jsx +177 -57
  6. package/src/ui/Card/Card.stories.test.jsx +206 -0
  7. package/src/ui/Footer/Footer.jsx +2 -2
  8. package/src/ui/Header/Header.jsx +71 -71
  9. package/src/ui/Header/Header.stories.js +58 -51
  10. package/src/ui/Header/Header.test.jsx +102 -4
  11. package/src/ui/Header/HeaderMenuPopUp.js +2 -3
  12. package/src/ui/InpageNavigation/InpageNavigation.jsx +5 -1
  13. package/src/ui/Item/Item.stories.test.js +2 -2
  14. package/src/ui/Item/ItemGroupWithIcons.stories.js +28 -18
  15. package/src/ui/Message/Message.stories.js +6 -6
  16. package/src/ui/Message/Message.stories.test.js +11 -5
  17. package/src/ui/Tab/Tab.stories.js +21 -5
  18. package/src/ui/Tab/Tab.stories.test.js +10 -0
  19. package/src/ui/TagList/TagList.stories.jsx +1 -1
  20. package/theme/themes/eea/collections/breadcrumb.overrides +4 -3
  21. package/theme/themes/eea/collections/menu.overrides +201 -15
  22. package/theme/themes/eea/collections/menu.variables +43 -28
  23. package/theme/themes/eea/collections/message.overrides +1 -1
  24. package/theme/themes/eea/collections/table.overrides +9 -15
  25. package/theme/themes/eea/elements/button.overrides +2 -2
  26. package/theme/themes/eea/elements/container.overrides +39 -34
  27. package/theme/themes/eea/elements/divider.overrides +13 -9
  28. package/theme/themes/eea/elements/image.overrides +5 -6
  29. package/theme/themes/eea/elements/label.overrides +16 -16
  30. package/theme/themes/eea/elements/list.overrides +3 -1
  31. package/theme/themes/eea/elements/segment.overrides +4 -4
  32. package/theme/themes/eea/extras/custom.overrides +43 -22
  33. package/theme/themes/eea/extras/header.less +2 -15
  34. package/theme/themes/eea/extras/header.variables +1 -3
  35. package/theme/themes/eea/extras/tag.less +5 -0
  36. package/theme/themes/eea/extras/tag.variables +1 -1
  37. package/theme/themes/eea/globals/site.overrides +63 -35
  38. package/theme/themes/eea/globals/site.variables +2 -5
  39. package/theme/themes/eea/globals/utilities.less +21 -1
  40. package/theme/themes/eea/modules/accordion.overrides +36 -24
  41. package/theme/themes/eea/modules/accordion.variables +4 -4
  42. package/theme/themes/eea/modules/checkbox.overrides +2 -2
  43. package/theme/themes/eea/modules/modal.overrides +2 -2
  44. package/theme/themes/eea/modules/search.overrides +4 -0
  45. package/theme/themes/eea/modules/tab.overrides +6 -12
  46. package/theme/themes/eea/modules/tab.variables +2 -1
  47. package/theme/themes/eea/tokens/colors.less +2 -2
  48. package/theme/themes/eea/views/card.overrides +50 -35
  49. package/theme/themes/eea/views/card.variables +7 -2
  50. package/theme/themes/eea/views/item.overrides +23 -27
  51. package/theme/themes/eea/views/item.variables +3 -5
  52. package/theme/themes/eea/views/statistic.overrides +13 -3
package/CHANGELOG.md CHANGED
@@ -4,6 +4,88 @@ 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.21.0](https://github.com/eea/volto-eea-design-system/compare/1.20.0...1.21.0) - 20 November 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(item): styling difference so that column group or section group flex template match design [David Ichim - [`f57e074`](https://github.com/eea/volto-eea-design-system/commit/f57e0744808df8b467e179b83266e8b2c2398956)]
12
+
13
+ #### :nail_care: Enhancements
14
+
15
+ - change(message): Renamed Error to ErrorMessage to avoid special identifier Sonarqube warning [David Ichim - [`09e49ac`](https://github.com/eea/volto-eea-design-system/commit/09e49ac4e71c02b439459eec29266d3f5b884d50)]
16
+ - change(header): dropdowns now auto open and close on focus and blur when using keyboard navigation [David Ichim - [`d558e9b`](https://github.com/eea/volto-eea-design-system/commit/d558e9bf7abba19221744be871759d025ce0f05a)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - Release 1.21.0 [Alin Voinea - [`fe39edd`](https://github.com/eea/volto-eea-design-system/commit/fe39edde81fd4f01f7958aee706887a5dedce521)]
21
+ - Modified test to reference ErrorMessage [David Ichim - [`36fefd0`](https://github.com/eea/volto-eea-design-system/commit/36fefd05a6b30d92494a7974c9fb86d35cae5acc)]
22
+ - Lint fix [David Ichim - [`c1fc104`](https://github.com/eea/volto-eea-design-system/commit/c1fc104f1e7be0611de4aa17c55ad9c402c70ff8)]
23
+ - Test Header onBlur [David Ichim - [`42f9c97`](https://github.com/eea/volto-eea-design-system/commit/42f9c97d01f7b59a1c63e42e1825dfa0697f0ef2)]
24
+ - Add dropdown test case to Header component [David Ichim - [`9ea3234`](https://github.com/eea/volto-eea-design-system/commit/9ea3234c2c0f1c819c7c2b54a75c56cda7812c56)]
25
+ - Remove unused import in Header.test.jsx [David Ichim - [`082069e`](https://github.com/eea/volto-eea-design-system/commit/082069e1f057786e0f1fb00c98d54b8e03b5d9c5)]
26
+ - Added some tests for TopDropdownMenu mobile and dropdown interaction [David Ichim - [`9d24488`](https://github.com/eea/volto-eea-design-system/commit/9d24488c1e97b2b1b14bd9bd8cb6f5b68414794b)]
27
+ - Lint fix [David Ichim - [`e29fd50`](https://github.com/eea/volto-eea-design-system/commit/e29fd50ee73477007dcf94a268596e6c11176d7b)]
28
+ ### [1.20.0](https://github.com/eea/volto-eea-design-system/compare/1.19.0...1.20.0) - 2 November 2023
29
+
30
+ #### :rocket: New Features
31
+
32
+ - 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)]
33
+ - 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)]
34
+ - feat(tabs): added inverted option to tabs storybook [David Ichim - [`d9e760b`](https://github.com/eea/volto-eea-design-system/commit/d9e760b069a48a7a4594c6dba0044755415d505d)]
35
+ - feat(tabs): added theme config to tabs storybook [David Ichim - [`01d1e85`](https://github.com/eea/volto-eea-design-system/commit/01d1e85b82b18cae7ac6519f86e471149c210e73)]
36
+ - 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)]
37
+ - 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)]
38
+ - 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)]
39
+
40
+ #### :bug: Bug Fixes
41
+
42
+ - 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)]
43
+ - 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)]
44
+ - 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)]
45
+ - fix: formatting (stylelint) [kreafox - [`ba35c2e`](https://github.com/eea/volto-eea-design-system/commit/ba35c2e000aa7443670de32f212af3e0c93f5576)]
46
+ - fix: redo changes [kreafox - [`101e957`](https://github.com/eea/volto-eea-design-system/commit/101e95777a40a1c8b3958c90c7f3a44152a48f7c)]
47
+ - 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)]
48
+ - 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)]
49
+ - 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)]
50
+ - fix(tabs): edit active tab background color [David Ichim - [`c5726a4`](https://github.com/eea/volto-eea-design-system/commit/c5726a467a39592415dae2a7e40616cf5a9a0bbf)]
51
+
52
+ #### :nail_care: Enhancements
53
+
54
+ - 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)]
55
+ - 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)]
56
+ - 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)]
57
+
58
+ #### :house: Internal changes
59
+
60
+ - chore: husky, lint-staged use fixed versions [valentinab25 - [`59ecb8e`](https://github.com/eea/volto-eea-design-system/commit/59ecb8e28b259472303324f9655b0cbbcbbf9c23)]
61
+
62
+ #### :hammer_and_wrench: Others
63
+
64
+ - bump package version preparing for release [David Ichim - [`c3bddab`](https://github.com/eea/volto-eea-design-system/commit/c3bddab1d2aa18b0cc2b1b4d5d9d8a4e437e6e07)]
65
+ - fixed missing comma from accordion selector [David Ichim - [`609f676`](https://github.com/eea/volto-eea-design-system/commit/609f67627c500d5e1d7714d4eb5598f78aafe90d)]
66
+ - prettier and stylelint fix commands [David Ichim - [`82ec097`](https://github.com/eea/volto-eea-design-system/commit/82ec097016b4d3ba06d36ae473151d636b00be6a)]
67
+ - style tabs with situations where we have secondary plus theme classes [David Ichim - [`41ee835`](https://github.com/eea/volto-eea-design-system/commit/41ee8353a43b25095d01c63a3bf9895ab7601b68)]
68
+ - Added color for inverted active menu [David Ichim - [`457e223`](https://github.com/eea/volto-eea-design-system/commit/457e223dc5a45ae5173fcdd239b89f2cbcc48942)]
69
+ - Added correct color for tab brown option [David Ichim - [`a4e58fe`](https://github.com/eea/volto-eea-design-system/commit/a4e58fefdfb5b35168bf8e514f8c1c1661d46288)]
70
+ - Style inverted secondary menu using css variables: [David Ichim - [`d3a8d7c`](https://github.com/eea/volto-eea-design-system/commit/d3a8d7c65472f9abcc93ccbe13b2c9ca5634266f)]
71
+ - 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)]
72
+ - 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)]
73
+ - test(Card): fix duplicated lines reported by sonarqube [kreafox - [`ef1fc33`](https://github.com/eea/volto-eea-design-system/commit/ef1fc337855049364d7fdc10621c8f4c376815f5)]
74
+ - test(Card): add missing tests for ImageGrid [kreafox - [`5971e01`](https://github.com/eea/volto-eea-design-system/commit/5971e01a2f4f5ba8a180ed2fd38df28d55ad92c0)]
75
+ - test(Card): add Card tests to check correct rendering [kreafox - [`1de5f50`](https://github.com/eea/volto-eea-design-system/commit/1de5f5065a0fa10a931b57fcc4f7831427f897cf)]
76
+ - inverted border should be transparent black instead of black [David Ichim - [`700b9e7`](https://github.com/eea/volto-eea-design-system/commit/700b9e7abef32d5721ea093baa122d8cd4eb5e1b)]
77
+ - 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)]
78
+ - 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)]
79
+ - 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)]
80
+ - stylelint fix [David Ichim - [`fd4831e`](https://github.com/eea/volto-eea-design-system/commit/fd4831ef31b70bcad8f8b3c49a14b47e857e5e36)]
81
+ - Removed pointing option from vertical tab by default: [David Ichim - [`19d1870`](https://github.com/eea/volto-eea-design-system/commit/19d187037a8aa7d5e2c8dfb518ebf3941d24839f)]
82
+ - 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)]
83
+ - 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)]
84
+ - 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)]
85
+ - fix test [Dobricean Ioan Dorian - [`6d6e3b9`](https://github.com/eea/volto-eea-design-system/commit/6d6e3b9fa83665dbdff206f0a8e5530c1a128ffe)]
86
+ - add jest test [Dobricean Ioan Dorian - [`cc9533c`](https://github.com/eea/volto-eea-design-system/commit/cc9533c41ef985d394be6b9bb5c776d03a37993c)]
87
+ - add styles for tabs [Dobricean Ioan Dorian - [`8448bf4`](https://github.com/eea/volto-eea-design-system/commit/8448bf4ed60b18a9a28e6e5ef4451fefc141d263)]
88
+ - 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
89
  ### [1.19.0](https://github.com/eea/volto-eea-design-system/compare/1.18.3...1.19.0) - 13 October 2023
8
90
 
9
91
  #### :bug: Bug Fixes
package/cypress.config.js CHANGED
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
4
  viewportWidth: 1280,
5
- defaultCommandTimeout: 5000,
5
+ defaultCommandTimeout: 8888,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
- video: true,
8
+ video: false,
9
9
  retries: {
10
- runMode: 1,
10
+ runMode: 2,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
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.21.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": {
@@ -3,6 +3,7 @@ import { Container, Icon, Button, Grid } from 'semantic-ui-react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
5
  import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
+ import cx from 'classnames';
6
7
  import config from '@plone/volto/registry';
7
8
 
8
9
  Banner.propTypes = {
@@ -44,7 +45,7 @@ export const sharePage = (url, platform) => {
44
45
  link.click();
45
46
  };
46
47
 
47
- function Banner({ image, metadata, properties, children, ...rest }) {
48
+ function Banner({ image, metadata, properties, children, styles, ...rest }) {
48
49
  if (image) {
49
50
  //extract Lead image from page content.
50
51
  const content = metadata || properties;
@@ -52,7 +53,7 @@ function Banner({ image, metadata, properties, children, ...rest }) {
52
53
  return (
53
54
  <div className="eea banner">
54
55
  <div
55
- className={imageUrl ? 'image' : ''}
56
+ className={cx(imageUrl ? 'image' : '', styles?.bg)}
56
57
  style={imageUrl ? { backgroundImage: `url(${imageUrl})` } : {}}
57
58
  >
58
59
  <div className="gradient">
@@ -72,21 +73,14 @@ function Banner({ image, metadata, properties, children, ...rest }) {
72
73
  }
73
74
 
74
75
  Banner.Action = React.forwardRef(function (
75
- { id, title, titleClass, icon, onClick, className, color, ...rest },
76
+ { title, titleClass, icon, onClick, className, color, ...rest },
76
77
  ref,
77
78
  ) {
78
79
  return (
79
80
  <div className="action" ref={ref}>
80
- <Button
81
- className={className}
82
- basic
83
- icon
84
- inverted
85
- onClick={onClick}
86
- {...rest}
87
- >
88
- <Icon className={icon} color={color}></Icon>
89
- <span className={titleClass || 'mobile hidden'}>{title}</span>
81
+ <Button className={className} basic icon inverted onClick={onClick}>
82
+ <Icon className={icon} color={color} title={title}></Icon>
83
+ <span className={titleClass || 'mobile-sr-only'}>{title}</span>
90
84
  </Button>
91
85
  </div>
92
86
  );
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Card, Image, Grid, Container, Icon, Button } from 'semantic-ui-react';
3
3
  import Slider from 'react-slick';
4
+ import TagList from '../TagList/TagList';
5
+ import Tag from '../Tag/Tag';
4
6
 
5
7
  import 'slick-carousel/slick/slick.css';
6
8
  import 'slick-carousel/slick/slick-theme.css';
@@ -8,71 +10,89 @@ import 'slick-carousel/slick/slick-theme.css';
8
10
  const tabletBreakpoint = 835;
9
11
  const mobileBreakpoint = 480;
10
12
 
11
- let cardModels = [
12
- {
13
- title: 'Economy and resources',
14
- imgUrl:
13
+ // Content for all cards
14
+ let cardData = {
15
+ cardContent: {
16
+ title: [
17
+ 'Economy and resources',
18
+ 'Health',
19
+ 'Nature',
20
+ 'Climate',
21
+ "State of Europe's environment",
22
+ ],
23
+ imgUrl: [
15
24
  '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
25
  '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
26
  '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
27
  '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
28
  'https://www.eea.europa.eu/en/topics/at-a-glance/state-of-europes-environment/@@images/image/preview',
67
- description:
29
+ ],
30
+ description: [
31
+ 'The economy plays a vital role in our lives by providing access to employment, ' +
32
+ 'products and services that help us thrive. Unfortunately, with its key sectors like agriculture,' +
33
+ ' energy and transport, our economy also harms the environment and causes climate change. ' +
34
+ 'Europe needs a circular, carbon-neutral and zero-pollution economy. ',
35
+ 'By improving air, water, and soil quality and limiting pollution released to nature, ' +
36
+ 'the EU has significantly contributed to enhancing human health in the last five ' +
37
+ 'decades. Yet, many vulnerable groups continue to be impacted by environmental ' +
38
+ 'degradation and climate change. Further improvements can help keep Europeans ' +
39
+ 'healthier and better equipped to cope with climate change impacts.',
40
+ 'Europe’s nature is filled with forests, mountains, vast plains, long rivers, deep blue seas and ' +
41
+ 'refreshing lakes. But it also is under threat. Unsustainable farming and forestry practices, ' +
42
+ 'pollution, climate change and invasive species are stressing and destabilising all natural ' +
43
+ 'systems in Europe. The result is a biodiversity crisis. The EU is taking steps to protect and restore nature.',
44
+ 'Climate change affects us all and is accelerating. Its impacts will become even more severe if ' +
45
+ 'the increase in global temperature is not kept below 1.5°C. The EU and its Member States are ' +
46
+ 'taking important steps to rapidly reduce greenhouse gas emissions and adapt to climate change.',
68
47
  '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.',
48
+ 'decades, such as cleaner air and water. Nevertheless, Europe, as well as the rest ' +
49
+ 'of the globe, is facing environmental challenges of unprecedented scale and urgency.',
50
+ ],
51
+ metaRight: [
52
+ '20/05/2023',
53
+ '30/04/2023',
54
+ '10/04/2023',
55
+ '02/04/2023',
56
+ '16/03/2023',
57
+ ],
58
+ eventDate: [
59
+ '20/05/2023',
60
+ '30/04/2023',
61
+ '10/04/2023',
62
+ '02/04/2023',
63
+ '16/03/2023',
64
+ ],
65
+ tags: [
66
+ { category: 'tag 1', href: '#' },
67
+ { category: 'tag 2', href: '#' },
68
+ { category: 'bigger tag', href: '#' },
69
+ { category: 'tag 3', href: '#' },
70
+ { category: 'tag 4', href: '#' },
71
+ ],
72
+ },
73
+ };
74
+
75
+ // Fill the cardModel array that stories use
76
+ let cardModels = [];
77
+ let tempCardContent = {};
78
+ for (var i = 0; i <= cardData.cardContent.title.length; i++) {
79
+ tempCardContent = {
80
+ title: cardData.cardContent.title[i],
81
+ imgUrl: cardData.cardContent.imgUrl[i],
82
+ description: cardData.cardContent.description[i],
71
83
  meta: 'Article',
72
- metaRight: '16/03/2022',
84
+ metaRight: cardData.cardContent.metaRight[i],
85
+ eventDate: cardData.cardContent.eventDate[i],
73
86
  href: '/#',
74
- },
75
- ];
87
+ tags: [],
88
+ };
89
+
90
+ // Fill cards with random amount of tags
91
+ for (var j = 0; j < Math.floor(Math.random() * 4 + 1); j++) {
92
+ tempCardContent.tags.push(cardData.cardContent.tags[j]);
93
+ }
94
+ cardModels.push(tempCardContent);
95
+ }
76
96
 
77
97
  export default {
78
98
  title: 'Components/Card/Default',
@@ -166,6 +186,15 @@ export default {
166
186
  defaultValue: { summary: '2' },
167
187
  },
168
188
  },
189
+ eventDate: {
190
+ name: 'Event date',
191
+ control: { type: 'boolean' },
192
+ table: {
193
+ category: 'Content',
194
+ defaultValue: { summary: 'false' },
195
+ type: { summary: 'boolean' },
196
+ },
197
+ },
169
198
  cards: {
170
199
  name: 'Cards content',
171
200
  table: {
@@ -176,6 +205,28 @@ export default {
176
205
  defaultValue: { summary: ' "" ' },
177
206
  },
178
207
  },
208
+ hasTags: {
209
+ name: 'Tags',
210
+ table: {
211
+ defaultValue: { summary: 'false' },
212
+ type: { summary: 'boolean' },
213
+ category: 'Tags',
214
+ },
215
+ },
216
+ direction: {
217
+ name: 'Tags direction',
218
+ control: { type: 'select' },
219
+ options: ['right', 'left'],
220
+ table: {
221
+ type: {
222
+ summary: 'string',
223
+ },
224
+ defaultValue: {
225
+ summary: 'left',
226
+ },
227
+ category: 'Tags',
228
+ },
229
+ },
179
230
  },
180
231
  };
181
232
 
@@ -192,6 +243,17 @@ const MetaRight = (args) => (
192
243
  <span className="bold text-right">{args.metaRight}</span>
193
244
  );
194
245
 
246
+ const EventDate = (args) => (
247
+ <>
248
+ {args.eventDate && (
249
+ <span className="event-date">
250
+ <Icon className="ri-calendar-line" />
251
+ <span>{args.eventDate}</span>
252
+ </span>
253
+ )}
254
+ </>
255
+ );
256
+
195
257
  const CardTemplate = ({
196
258
  variant,
197
259
  inverted,
@@ -201,8 +263,11 @@ const CardTemplate = ({
201
263
  objectPosition,
202
264
  titleMaxLines,
203
265
  maxLines,
266
+ eventDate,
204
267
  fluid,
205
268
  card,
269
+ hasTags,
270
+ direction,
206
271
  }) => (
207
272
  <Card
208
273
  fluid={fluid}
@@ -244,8 +309,24 @@ const CardTemplate = ({
244
309
  ''
245
310
  )}
246
311
 
312
+ {/* Event date */}
313
+ {eventDate && <EventDate {...card} />}
314
+
247
315
  {/* Description */}
248
316
  <Card.Description>{card.description}</Card.Description>
317
+ {hasTags && (
318
+ <div className="card-tags">
319
+ <TagList className={direction}>
320
+ <TagList.Content>
321
+ {card.tags.map((tag, index) => [
322
+ <Tag href={tag.href} key={index}>
323
+ {tag.category}
324
+ </Tag>,
325
+ ])}
326
+ </TagList.Content>
327
+ </TagList>
328
+ </div>
329
+ )}
249
330
  </Card.Content>
250
331
 
251
332
  {/* Additional links */}
@@ -276,9 +357,12 @@ Default.args = {
276
357
  objectPosition: 'center',
277
358
  titleMaxLines: '2',
278
359
  maxLines: '2',
360
+ eventDate: false,
279
361
  numberOfCards: 1,
280
362
  fluid: false,
281
363
  cards: [...cardModels],
364
+ hasTags: false,
365
+ direction: 'left',
282
366
  };
283
367
  const GridTemplate = (args) => (
284
368
  <Container>
@@ -302,9 +386,12 @@ CardGrid.args = {
302
386
  objectPosition: 'center',
303
387
  titleMaxLines: '2',
304
388
  maxLines: '2',
389
+ eventDate: false,
305
390
  fluid: true,
306
391
  numberOfCards: 5,
307
392
  cards: [...cardModels],
393
+ hasTags: false,
394
+ direction: 'left',
308
395
  };
309
396
 
310
397
  const ImageCard = ({
@@ -350,6 +437,8 @@ ImageGrid.args = {
350
437
  fluid: true,
351
438
  cards: [...cardModels],
352
439
  numberOfCards: 5,
440
+ hasTags: false,
441
+ direction: 'left',
353
442
  };
354
443
 
355
444
  ImageGrid.argTypes = {
@@ -363,6 +452,11 @@ ImageGrid.argTypes = {
363
452
  disable: true,
364
453
  },
365
454
  },
455
+ eventDate: {
456
+ table: {
457
+ disable: true,
458
+ },
459
+ },
366
460
  maxLines: {
367
461
  table: {
368
462
  disable: true,
@@ -391,8 +485,11 @@ FluidGrid.args = {
391
485
  titleMaxLines: '2',
392
486
  maxLines: '2',
393
487
  numberOfCards: 3,
488
+ eventDate: false,
394
489
  fluid: true,
395
490
  cards: [...cardModels],
491
+ hasTags: false,
492
+ direction: 'left',
396
493
  };
397
494
  const PrevArrow = (props) => {
398
495
  const { onClick } = props;
@@ -481,6 +578,7 @@ CarouselCards.args = {
481
578
  objectPosition: 'center',
482
579
  titleMaxLines: '2',
483
580
  maxLines: '2',
581
+ eventDate: false,
484
582
  fluid: true,
485
583
  settings: {
486
584
  dots: true,
@@ -511,6 +609,8 @@ CarouselCards.args = {
511
609
  },
512
610
  numberOfCards: 5,
513
611
  cards: [...cardModels],
612
+ hasTags: false,
613
+ direction: 'left',
514
614
  };
515
615
  CarouselCards.argTypes = {
516
616
  settings: {
@@ -534,7 +634,10 @@ const TeaserCard = ({
534
634
  titleMaxLines,
535
635
  fluid,
536
636
  maxLines,
637
+ eventDate,
537
638
  card,
639
+ hasTags,
640
+ direction,
538
641
  }) => (
539
642
  <div className="column grid-block-teaser">
540
643
  <div
@@ -571,7 +674,21 @@ const TeaserCard = ({
571
674
  <div className="header">
572
675
  <a href={card.href}>{card.title}</a>
573
676
  </div>
677
+ {eventDate && <EventDate {...card} />}
574
678
  <Card.Description>{card.description}</Card.Description>
679
+ {hasTags && (
680
+ <div className="card-tags">
681
+ <TagList className={direction}>
682
+ <TagList.Content>
683
+ {card.tags.map((tag, index) => [
684
+ <Tag href={tag.href} key={index}>
685
+ {tag.category}
686
+ </Tag>,
687
+ ])}
688
+ </TagList.Content>
689
+ </TagList>
690
+ </div>
691
+ )}
575
692
  </div>
576
693
  )}
577
694
  </div>
@@ -612,7 +729,10 @@ TeaserCardGrid.args = {
612
729
  objectPosition: 'center',
613
730
  titleMaxLines: '2',
614
731
  maxLines: '2',
732
+ eventDate: false,
615
733
  fluid: true,
616
734
  numberOfCards: 3,
617
735
  cards: [...cardModels],
736
+ hasTags: false,
737
+ direction: 'left',
618
738
  };