@eeacms/volto-eea-design-system 0.8.1 → 0.9.1

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
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",
@@ -1,66 +1,144 @@
1
1
  import React from 'react';
2
+ import { Container, Icon } from 'semantic-ui-react';
2
3
 
3
- const Template = (args) => (
4
- <nav className="context-navigation">
5
- <div className="context-navigation-header">Navigation</div>
6
- <div role="list" className="ui list">
7
- <div role="listitem" className="item level-1">
8
- <div className="content">
9
- <a title="" className="contenttype-folder" href="/api/folder1">
10
- Folder1
11
- </a>
4
+ const sidenavItems = [
5
+ {
6
+ '@id': 'Gravida',
7
+ items: [
8
+ {
9
+ '@id': 'Lorem-ipsum-0',
10
+ description: '',
11
+ items: [],
12
+ review_state: null,
13
+ title: 'Item 1',
14
+ url: '/#',
15
+ },
16
+ {
17
+ '@id': 'item-2',
18
+ description: '',
19
+ items: [],
20
+ review_state: null,
21
+ title: 'Item 2',
22
+ url: '/#',
23
+ },
24
+ {
25
+ '@id': 'item-3',
26
+ description: '',
27
+ items: [],
28
+ review_state: null,
29
+ title: 'Item 3',
30
+ url: '/#',
31
+ },
32
+ ],
33
+ review_state: null,
34
+ title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
35
+ url: '/#',
36
+ },
37
+ {
38
+ '@id': 'Signals-2021',
39
+ description: '',
40
+ items: [],
41
+ review_state: null,
42
+ title: 'Signals 2021',
43
+ url: '/#',
44
+ },
45
+ {
46
+ '@id': 'Articles',
47
+ description: '',
48
+ items: [],
49
+ review_state: null,
50
+ title: 'Articles',
51
+ url: '/#',
52
+ },
53
+ {
54
+ '@id': 'Infographics',
55
+ items: [
56
+ {
57
+ '@id': 'Lorem-ipsum-1',
58
+ description: '',
59
+ items: [],
60
+ review_state: null,
61
+ title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
62
+ url: '/#',
63
+ },
64
+ {
65
+ '@id': 'Signals-2021-infographics',
66
+ description: '',
67
+ items: [],
68
+ review_state: null,
69
+ title: 'Signals 2021',
70
+ url: '/#',
71
+ },
72
+ {
73
+ '@id': 'Articles',
74
+ description: '',
75
+ items: [],
76
+ review_state: null,
77
+ title: 'Articles',
78
+ url: '/#',
79
+ },
80
+ {
81
+ '@id': 'Infographics-overview',
82
+ description: '',
83
+ items: [],
84
+ review_state: null,
85
+ title: 'Infographics',
86
+ url: '/#',
87
+ },
88
+ ],
89
+ review_state: null,
90
+ title: 'Infographics',
91
+ url: '/#',
92
+ },
93
+ ];
94
+
95
+ function Template({ ...args }) {
96
+ return (
97
+ <Container>
98
+ <nav className="context-navigation">
99
+ <div className="context-navigation-header">
100
+ <Icon className="ri-menu-2-line" /> {args.header}
12
101
  </div>
13
- </div>
14
- <div role="listitem" className="item level-1">
15
- <div className="content">
16
- <a
17
- title=""
18
- className="contenttype-folder in_path"
19
- href="/api/folder2/folder21"
20
- >
21
- Folder21
22
- </a>
23
- <div className="list">
24
- <div role="listitem" className="item level-2">
25
- <div className="content">
26
- <a
27
- title=""
28
- className="contenttype-document"
29
- href="/api/folder2/folder21/doc211"
30
- >
31
- Doc211
32
- </a>
33
- </div>
34
- </div>
35
- <div role="listitem" className="active item level-2">
36
- <div className="content">
37
- <a
38
- title=""
39
- className="contenttype-document"
40
- href="/api/folder2/folder21/doc211-copy"
41
- >
42
- Doc212
43
- <div className="content active-indicator">
44
- <svg
45
- xmlns="http://www.w3.org/2000/svg"
46
- viewBox="0 0 36 36"
47
- className="icon"
102
+ <div role="list" className="ui list">
103
+ {args.sidenavItems &&
104
+ args.sidenavItems.map((element, index) => {
105
+ return (
106
+ <div role="listitem" className="item level-1">
107
+ <div className="content">
108
+ <a
109
+ title={element.title}
110
+ className="contenttype-folder"
111
+ href={element.url}
48
112
  >
49
- <path
50
- fill-rule="evenodd"
51
- d="M21.293 9.293L22.707 10.707 15.414 18 22.707 25.293 21.293 26.707 12.586 18z"
52
- ></path>
53
- </svg>
113
+ {element.title}
114
+ </a>
115
+ {element.items.length > 0 &&
116
+ element.items.map((subelement, index) => {
117
+ return (
118
+ <div className="list" role="list">
119
+ <div role="listitem" className="item level-2">
120
+ <div className="content">
121
+ <a
122
+ title={subelement.title}
123
+ className="contenttype-document"
124
+ href={subelement.url}
125
+ >
126
+ {subelement.title}
127
+ </a>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ );
132
+ })}
54
133
  </div>
55
- </a>
56
- </div>
57
- </div>
58
- </div>
134
+ </div>
135
+ );
136
+ })}
59
137
  </div>
60
- </div>
61
- </div>
62
- </nav>
63
- );
138
+ </nav>
139
+ </Container>
140
+ );
141
+ }
64
142
 
65
143
  export default {
66
144
  title: 'Components/Navigation portlet',
@@ -69,5 +147,6 @@ export default {
69
147
 
70
148
  export const Default = Template.bind({});
71
149
  Default.args = {
72
- root: 'https://www.eea.europa.eu/',
150
+ header: 'Navigation',
151
+ sidenavItems: sidenavItems,
73
152
  };
@@ -41,10 +41,12 @@ const TopDropdownMenu = ({
41
41
  className,
42
42
  icon,
43
43
  id,
44
+ tabletText,
44
45
  mobileText,
45
46
  text,
46
47
  viewportWidth,
47
48
  }) => {
49
+ const isTablet = viewportWidth < 991;
48
50
  const isMobile = viewportWidth < 767;
49
51
 
50
52
  const Component = ({ mobileText }) => (
@@ -55,13 +57,21 @@ const TopDropdownMenu = ({
55
57
  icon={icon || 'chevron down'}
56
58
  aria-label="dropdown"
57
59
  closeOnChange={false}
58
- closeOnBlur={false}
60
+ closeOnBlur={true}
59
61
  >
60
62
  <Dropdown.Menu role="group">{children}</Dropdown.Menu>
61
63
  </Dropdown>
62
64
  );
63
65
  return (
64
- <>{isMobile ? <Component mobileText={mobileText} /> : <Component />}</>
66
+ <>
67
+ {isMobile ? (
68
+ <Component mobileText={mobileText} />
69
+ ) : isTablet ? (
70
+ <Component mobileText={tabletText} />
71
+ ) : (
72
+ <Component />
73
+ )}
74
+ </>
65
75
  );
66
76
  };
67
77
 
@@ -197,7 +197,7 @@ p.ui.button {
197
197
  .ui.inverted.primary.button.active,
198
198
  .ui.inverted.primary.buttons .button:active,
199
199
  .ui.inverted.primary.button:active {
200
- color: @invertedHoveredTextColor;
200
+ color: @invertedHoveredTextColor !important;
201
201
  }
202
202
 
203
203
  .ui.inverted.primary.buttons .button:hover,
@@ -235,7 +235,7 @@ p.ui.button {
235
235
  .ui.inverted.secondary.button.active,
236
236
  .ui.inverted.secondary.buttons .button:active,
237
237
  .ui.inverted.secondary.button:active {
238
- color: @invertedHoveredTextColor;
238
+ color: @invertedHoveredTextColor !important;
239
239
  }
240
240
 
241
241
  .ui.inverted.secondary.buttons .button:hover,
@@ -280,7 +280,7 @@ p.ui.button {
280
280
  .ui.inverted.tertiary.buttons .button:active,
281
281
  .ui.inverted.tertiary.button:active {
282
282
  box-shadow: none !important; // button.less - L:3142
283
- color: @invertedHoveredTextColor;
283
+ color: @invertedHoveredTextColor !important;
284
284
  }
285
285
 
286
286
  .ui.tertiary.buttons .button:hover,
@@ -48,7 +48,7 @@
48
48
  @searchButtonIconLeft: 1.25rem;
49
49
  @searchButtonIconOpacity: 0.625rem;
50
50
 
51
- @verticalMargin: 0em;
51
+ @verticalMargin: 0.25em;
52
52
  @horizontalMargin: 0.25em;
53
53
  @backgroundColor: @silverGray;
54
54
  @backgroundImage: none;
@@ -8,6 +8,9 @@
8
8
 
9
9
  // This override on .block .ui.image is needed as it
10
10
  // sets width: 100% by default
11
+ .ui.image {
12
+ max-width: var(--image-max-width, 100%);
13
+ }
11
14
 
12
15
  .block .ui.mini.image {
13
16
  width: @miniWidth;
@@ -11,7 +11,7 @@
11
11
  display: flex;
12
12
  min-width: @eeaLoaderMinWidth;
13
13
  max-width: @eeaLoaderMaxWidth;
14
- align-items: end;
14
+ align-items: flex-end;
15
15
  justify-content: center;
16
16
  padding: @eeaLoaderPadding;
17
17
  animation: loaderPulse ease-out 2.5s infinite;
@@ -21,7 +21,7 @@
21
21
  padding: @mobileContentPadding;
22
22
 
23
23
  .ui.grid {
24
- align-items: end;
24
+ align-items: flex-end;
25
25
  }
26
26
 
27
27
  .title {
@@ -3,78 +3,85 @@
3
3
 
4
4
  @import (multiple) '../../theme.config';
5
5
 
6
-
7
- // default styles delete
8
- .list .content .list a {
9
- padding-left: 2rem !important;
10
- }
11
- .in_path {
12
- font-weight: bold !important;
13
- }
14
- .list .content .list {
15
- padding-top: 0!important;
16
- padding-bottom: 0!important;
17
- border-top: 1px solid #eee;
18
- border-bottom: 1px solid #eee;
19
- }
20
6
  .context-navigation {
21
- margin-right: 1rem;
22
- background : white;
23
- padding : 0;
24
- max-width : 210px;
25
- box-shadow : 0 0 12px rgba(0, 0, 0, 0.2);
26
- list-style-type: none;
27
- border-radius : 4px;
28
- overflow : hidden;
7
+ max-width : @widescreenSidenavMaxWidth;
8
+ background : @sidenavBackground;
9
+ margin-right : @sidenavMarginRight;
10
+ padding-left : @sidenavPaddingLeft;
11
+ overflow : @sidenavOverflow;
29
12
  }
30
- @media(max-width: 1200px) {
13
+ @media (max-width: @largeMonitorBreakpoint) {
31
14
  .context-navigation {
32
- box-shadow: none;
33
- max-width: 200px;
34
- margin: 2rem auto;
15
+ max-width: @sidenavMaxWidth;
16
+ margin: @sidenavMargin;
35
17
  }
36
18
  }
19
+
37
20
  .context-navigation .item a {
38
- padding : .6rem 1rem;
39
- font-size : 1rem;
40
- font-weight: 400;
41
21
  display : block;
42
- position: relative;
43
- color: #444;
22
+ padding : @sidenavItemPadding;
23
+ font-size : @sidenavItemFontSize;
24
+ font-weight: @sidenavItemFontWeight;
25
+ color : @sidenavItemColor;
26
+
27
+ &:hover {
28
+ background: @sidenavItemHoverBackground;
29
+ color : @sidenavItemHoverColor;
30
+ }
44
31
  }
45
- @media (min-width: 1200px) and (max-width: 1500px) {
46
- .context-navigation .item a {
47
- font-size: .9rem;
32
+
33
+ .context-navigation-header {
34
+ display : flex;
35
+ color : @sidenavHeaderColor;
36
+ font-size : @sidenavHeaderFontSize;
37
+ font-weight: @sidenavHeaderFontWeight;
38
+ padding : @sidenavHeaderPadding;
39
+ border-bottom: @sidenavHeaderBorderBottom;
40
+
41
+ i.icon {
42
+ margin-right: @sidenavHeaderIconMarginRight;
48
43
  }
49
44
  }
50
- .context-navigation .item a:hover {
51
- background: #cc4400 !important;
52
- color : white !important;
45
+
46
+ .context-navigation a.contenttype-folder {
47
+ font-size : @sidenavFolderFontSize;
48
+ font-weight: @sidenavFolderFontWeight;
49
+ padding : @sidenavFolderItemPadding;
50
+ }
51
+
52
+ .context-navigation .ui.list > .item > .content {
53
+ border-bottom: @sidenavContentBorderBottom;
53
54
  }
54
- .context-navigation-header {
55
- color : #333;
56
- font-size : 16px;
57
- font-weight: 500;
58
- padding : 1rem;
59
- box-shadow : 0 4px 19px rgba(0, 0, 1, 0.07);
60
- border-bottom: 3px solid #cc4400;
55
+
56
+ // Hide last border
57
+ .context-navigation .ui.list > .item:last-child > .content {
58
+ border-bottom: none;
61
59
  }
62
- .context-navigation-header a {
63
- color: #444;
64
- font-size: 1.3rem;
65
- font-weight: 100;
60
+
61
+ // Nav custom list
62
+ .context-navigation .ui.list {
63
+ margin: 0;
64
+
65
+ .item,
66
+ .item .list {
67
+ padding: 0;
68
+ }
66
69
  }
67
- .context-navigation .active-indicator {
68
- position: absolute;
69
- right: 0;
70
- top: 50%;
71
- transform: translateY(-50%);
72
- color: #cc4400;
73
- font-weight: bold;
70
+
71
+ .context-navigation .level-1 .item:last-child a {
72
+ margin-bottom: @sidenavLastItemMarginBottom;
74
73
  }
75
- .active-indicator .icon {
76
- height: 30px;
74
+
75
+ .context-navigation .item.level-1 .ui.divider {
76
+ border-bottom: none;
77
77
  }
78
- .context-navigation .item a:hover .active-indicator {
79
- color : white !important;
78
+
79
+ // Active indicator
80
+ .context-navigation .item a.active {
81
+ color: @sidenavItemActiveColor;
82
+ font-weight: @sidenavItemActiveFontWeight;
80
83
  }
84
+
85
+ .context-navigation .item a.active:hover {
86
+ color : @sidenavItemActiveColorHover;
87
+ }
@@ -0,0 +1,41 @@
1
+ /*******************************
2
+ Sidebar Nav
3
+ *******************************/
4
+
5
+ @sidenavMaxWidth: 350px;
6
+ @widescreenSidenavMaxWidth: 300px;
7
+ @sidenavBackground: @grey-0;
8
+ @sidenavMarginRight: @rem-space-4;
9
+ @sidenavPaddingLeft: @rem-space-4;
10
+ @sidenavOverflow: hidden;
11
+ @sidenavMargin: @rem-space-8 auto;
12
+
13
+ /* Header */
14
+ @sidenavHeaderColor: @blue-grey-5;
15
+ @sidenavHeaderFontSize: @font-size-3;
16
+ @sidenavHeaderFontWeight: @font-weight-7;
17
+ @sidenavHeaderPadding: @rem-space-4;
18
+ @sidenavHeaderBorderBottom: @2px solid @blue-grey-5;
19
+ @sidenavHeaderIconMarginRight: @rem-space-4;
20
+
21
+ /* Content */
22
+ @sidenavContentBorderBottom: 1px solid @tertiaryColor;
23
+
24
+ /* Nav item */
25
+ @sidenavItemPadding: @rem-space-2 0 @rem-space-2 @rem-space-8;
26
+ @sidenavItemFontSize: @font-size-1;
27
+ @sidenavItemFontWeight: @font-weight-4;
28
+ @sidenavItemColor: @blue-grey-5;
29
+ @sidenavItemHoverBackground: @blue-grey-5;
30
+ @sidenavItemHoverColor: @grey-0;
31
+ @sidenavLastItemMarginBottom: @rem-space-2;
32
+
33
+ /* Item active */
34
+ @sidenavItemActiveColor: @secondaryColor;
35
+ @sidenavItemActiveFontWeight: @font-weight-7;
36
+ @sidenavItemActiveColorHover: @grey-0;
37
+
38
+ /* Folders - Level 1 */
39
+ @sidenavFolderFontSize: @font-size-2;
40
+ @sidenavFolderFontWeight: @font-weight-7;
41
+ @sidenavFolderItemPadding: @rem-space-4 0 @rem-space-4 @rem-space-4;