@eeacms/volto-bise-policy 1.0.0 → 1.0.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/package.json +3 -1
  3. package/src/components/manage/Blocks/NewsletterSignup/Edit.jsx +30 -0
  4. package/src/components/manage/Blocks/NewsletterSignup/View.jsx +13 -0
  5. package/src/components/manage/Blocks/NewsletterSignup/index.js +49 -0
  6. package/src/components/manage/Blocks/NewsletterSignup/schema.js +25 -0
  7. package/src/components/manage/Blocks/index.js +2 -0
  8. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +354 -0
  9. package/src/customizations/@eeacms/volto-eea-website-theme/components/theme/SubsiteClass.jsx +70 -0
  10. package/src/customizations/volto/components/manage/Edit/Edit.jsx +519 -0
  11. package/src/customizations/volto/components/manage/Form/BlockDataForm.jsx +28 -0
  12. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +214 -0
  13. package/src/customizations/volto/components/manage/Form/Field.jsx +269 -0
  14. package/src/customizations/volto/components/manage/Form/Form.jsx +804 -0
  15. package/src/customizations/volto/components/theme/Header/Header.jsx +151 -131
  16. package/src/index.js +31 -5
  17. package/theme/collections/message.overrides +10 -0
  18. package/theme/elements/container.overrides +156 -0
  19. package/theme/elements/segment.variables +1 -0
  20. package/theme/extras/header.overrides +107 -13
  21. package/theme/extras/header.variables +12 -0
  22. package/theme/extras/keyfacts.less +3 -3
  23. package/theme/extras/pluggables.less +17 -16
  24. package/theme/fonts/OpenSans-Bold.ttf +0 -0
  25. package/theme/fonts/OpenSans-Regular.ttf +0 -0
  26. package/theme/fonts/OpenSans-Semibold.ttf +0 -0
  27. package/theme/fonts/Rajdhani-Bold.ttf +0 -0
  28. package/theme/fonts/Rajdhani-Regular.ttf +0 -0
  29. package/theme/globals/helpers.less +75 -0
  30. package/theme/globals/natura2000.less +53 -0
  31. package/theme/globals/site.overrides +204 -4
  32. package/theme/globals/site.variables +5 -0
  33. package/theme/modules/accordion.overrides +3 -0
  34. package/theme/modules/accordion.variables +7 -0
  35. package/theme/modules/tab.overrides +176 -0
  36. package/theme/theme.config +1 -0
  37. package/theme/views/card.variables +2 -0
  38. package/locales/bg/LC_MESSAGES/volto.po +0 -14
  39. package/locales/bg.json +0 -1
  40. package/locales/bs/LC_MESSAGES/volto.po +0 -14
  41. package/locales/bs.json +0 -1
  42. package/locales/cs/LC_MESSAGES/volto.po +0 -14
  43. package/locales/cs.json +0 -1
  44. package/locales/da/LC_MESSAGES/volto.po +0 -14
  45. package/locales/da.json +0 -1
  46. package/locales/de/LC_MESSAGES/volto.po +0 -29
  47. package/locales/de.json +0 -1
  48. package/locales/el/LC_MESSAGES/volto.po +0 -14
  49. package/locales/el.json +0 -1
  50. package/locales/en/LC_MESSAGES/volto.po +0 -14
  51. package/locales/en.json +0 -1
  52. package/locales/es/LC_MESSAGES/volto.po +0 -24
  53. package/locales/es.json +0 -1
  54. package/locales/et/LC_MESSAGES/volto.po +0 -14
  55. package/locales/et.json +0 -1
  56. package/locales/eu/LC_MESSAGES/volto.po +0 -19
  57. package/locales/eu.json +0 -1
  58. package/locales/fi/LC_MESSAGES/volto.po +0 -14
  59. package/locales/fi.json +0 -1
  60. package/locales/fr/LC_MESSAGES/volto.po +0 -29
  61. package/locales/fr.json +0 -1
  62. package/locales/ga/LC_MESSAGES/volto.po +0 -14
  63. package/locales/ga.json +0 -1
  64. package/locales/hr/LC_MESSAGES/volto.po +0 -14
  65. package/locales/hr.json +0 -1
  66. package/locales/hu/LC_MESSAGES/volto.po +0 -14
  67. package/locales/hu.json +0 -1
  68. package/locales/is/LC_MESSAGES/volto.po +0 -14
  69. package/locales/is.json +0 -1
  70. package/locales/it/LC_MESSAGES/volto.po +0 -14
  71. package/locales/it.json +0 -1
  72. package/locales/ja/LC_MESSAGES/volto.po +0 -21
  73. package/locales/ja.json +0 -1
  74. package/locales/lt/LC_MESSAGES/volto.po +0 -14
  75. package/locales/lt.json +0 -1
  76. package/locales/lv/LC_MESSAGES/volto.po +0 -14
  77. package/locales/lv.json +0 -1
  78. package/locales/mk/LC_MESSAGES/volto.po +0 -14
  79. package/locales/mk.json +0 -1
  80. package/locales/mt/LC_MESSAGES/volto.po +0 -14
  81. package/locales/mt.json +0 -1
  82. package/locales/nl/LC_MESSAGES/volto.po +0 -33
  83. package/locales/nl.json +0 -1
  84. package/locales/no/LC_MESSAGES/volto.po +0 -14
  85. package/locales/no.json +0 -1
  86. package/locales/pl/LC_MESSAGES/volto.po +0 -14
  87. package/locales/pl.json +0 -1
  88. package/locales/pt/LC_MESSAGES/volto.po +0 -22
  89. package/locales/pt.json +0 -1
  90. package/locales/pt_BR/LC_MESSAGES/volto.po +0 -20
  91. package/locales/pt_BR.json +0 -1
  92. package/locales/ro/LC_MESSAGES/volto.po +0 -20
  93. package/locales/ro.json +0 -1
  94. package/locales/sh/LC_MESSAGES/volto.po +0 -14
  95. package/locales/sh.json +0 -1
  96. package/locales/sk/LC_MESSAGES/volto.po +0 -14
  97. package/locales/sk.json +0 -1
  98. package/locales/sl/LC_MESSAGES/volto.po +0 -14
  99. package/locales/sl.json +0 -1
  100. package/locales/sq/LC_MESSAGES/volto.po +0 -14
  101. package/locales/sq.json +0 -1
  102. package/locales/sv/LC_MESSAGES/volto.po +0 -14
  103. package/locales/sv.json +0 -1
  104. package/locales/tr/LC_MESSAGES/volto.po +0 -14
  105. package/locales/tr.json +0 -1
package/CHANGELOG.md CHANGED
@@ -4,7 +4,21 @@ 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.0.0](https://github.com/eea/volto-bise-policy/compare/0.1.0...1.0.0) - 7 December 2022
7
+ ### [1.0.1](https://github.com/eea/volto-bise-policy/compare/1.0.0...1.0.1) - 29 March 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(package.json): add @eeacms/volto-block-toc addon to addons list [Miu Razvan - [`ba5d5e6`](https://github.com/eea/volto-bise-policy/commit/ba5d5e6931b5ec324f6aa8c6b735e17963e71db2)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - chore(Jenkinsfile): remove VOLTO variable value [Miu Razvan - [`2c64b0d`](https://github.com/eea/volto-bise-policy/commit/2c64b0d534f670a5a8300927b10c398a3dba05ae)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - update [Miu Razvan - [`639f91a`](https://github.com/eea/volto-bise-policy/commit/639f91a3830640e0d9062b136dd8184027d288f7)]
20
+ - Remove locales [Miu Razvan - [`06be14b`](https://github.com/eea/volto-bise-policy/commit/06be14ba9f5e5f2a4c8609d90e1e16381fa784b0)]
21
+ ## [1.0.0](https://github.com/eea/volto-bise-policy/compare/0.1.0...1.0.0) - 7 December 2022
8
22
 
9
23
  #### :hammer_and_wrench: Others
10
24
 
@@ -19,7 +33,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
19
33
  - Update [Miu Razvan - [`487a390`](https://github.com/eea/volto-bise-policy/commit/487a3900f707d88a40d435d88ff6072f1eb9698f)]
20
34
  - Fix Jenkinsfile [Miu Razvan - [`96f92cc`](https://github.com/eea/volto-bise-policy/commit/96f92cc4f14b066ced8ec1c6e48a782780f10d80)]
21
35
  - Rename to volto-bise-policy [Miu Razvan - [`045b4aa`](https://github.com/eea/volto-bise-policy/commit/045b4aa61164c51db36db40fee1151d31829b9fa)]
22
- - Initial bise eea design [Miu Razvan - [`8fdb2d9`](https://github.com/eea/volto-bise-policy/commit/8fdb2d980f57a99d52ecd2c6b0114156108b051f)]
23
36
  ### 0.1.0 - 7 December 2022
24
37
 
25
38
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-bise-policy",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "@eeacms/volto-bise-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -14,6 +14,7 @@
14
14
  ],
15
15
  "addons": [
16
16
  "@eeacms/volto-datablocks",
17
+ "@eeacms/volto-block-toc",
17
18
  "@eeacms/volto-eea-design-system",
18
19
  "@eeacms/volto-eea-website-theme"
19
20
  ],
@@ -23,6 +24,7 @@
23
24
  },
24
25
  "dependencies": {
25
26
  "@eeacms/volto-datablocks": "*",
27
+ "@eeacms/volto-block-toc": "*",
26
28
  "@eeacms/volto-eea-design-system": "*",
27
29
  "@eeacms/volto-eea-website-theme": "*",
28
30
  "esri-loader": "3.7.0"
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
3
+ import View from './View';
4
+
5
+ import schema from './schema';
6
+
7
+ const Edit = (props) => {
8
+ return (
9
+ <>
10
+ <View {...props} mode="edit" />
11
+ <SidebarPortal selected={props.selected}>
12
+ <BlockDataForm
13
+ schema={schema}
14
+ title={schema.title}
15
+ onChangeField={(id, value) => {
16
+ props.onChangeBlock(props.block, {
17
+ ...props.data,
18
+ [id]: value,
19
+ });
20
+ }}
21
+ onChangeBlock={props.onChangeBlock}
22
+ formData={props.data}
23
+ block={props.block}
24
+ />
25
+ </SidebarPortal>
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default Edit;
@@ -0,0 +1,13 @@
1
+ import { withBlockExtensions } from '@plone/volto/helpers';
2
+
3
+ const View = (props) => {
4
+ const Renderer = props.variation.render;
5
+
6
+ return (
7
+ <>
8
+ <Renderer {...props} />
9
+ </>
10
+ );
11
+ };
12
+
13
+ export default withBlockExtensions(View);
@@ -0,0 +1,49 @@
1
+ import imageSVG from '@plone/volto/icons/image.svg';
2
+ import NavigationBlockView from './View';
3
+ import NavigationBlockEdit from './Edit';
4
+
5
+ export default (config) => {
6
+ config.blocks.blocksConfig.newsletterSignup = {
7
+ id: 'newsletterSignup',
8
+ title: 'Newsletter signup',
9
+ icon: imageSVG,
10
+ group: 'common',
11
+ view: NavigationBlockView,
12
+ edit: NavigationBlockEdit,
13
+ restricted: false,
14
+ mostUsed: false,
15
+ variations: [
16
+ {
17
+ id: 'default',
18
+ title: 'Default',
19
+ isDefault: true,
20
+ render: (props) => {
21
+ const { hasImage, imgSrc } = props.data;
22
+
23
+ return (
24
+ <>
25
+ View mode
26
+ {hasImage && imgSrc && (
27
+ <img src={`${props.data.imgSrc}/@@images/image`} alt="asda" />
28
+ )}
29
+ </>
30
+ );
31
+ },
32
+ },
33
+ {
34
+ id: 'enisa_newsletter',
35
+ title: 'Enisa newsletter',
36
+ render: () => 'is enisa newsletter',
37
+ schemaEnhancer: ({ schema, formData, intl }) => {
38
+ return schema;
39
+ },
40
+ },
41
+ ],
42
+ sidebarTab: 1,
43
+ security: {
44
+ addPermission: [],
45
+ view: [],
46
+ },
47
+ };
48
+ return config;
49
+ };
@@ -0,0 +1,25 @@
1
+ export default {
2
+ title: 'Newsletter signup',
3
+
4
+ fieldsets: [
5
+ {
6
+ id: 'default',
7
+ title: 'Default',
8
+ fields: ['hasImage', 'imgSrc'],
9
+ },
10
+ ],
11
+
12
+ properties: {
13
+ hasImage: {
14
+ title: 'Has image',
15
+ type: 'boolean',
16
+ default: true,
17
+ },
18
+ imgSrc: {
19
+ title: 'Image',
20
+ widget: 'attachedimage',
21
+ },
22
+ },
23
+
24
+ required: [],
25
+ };
@@ -4,6 +4,7 @@ import installFactsheetsListing from './FactsheetsListing';
4
4
  import installKeyFacts from './KeyFacts';
5
5
  import installMaesViewer from './MaesViewer';
6
6
  import installNavigation from './Navigation';
7
+ import installNewsletter from './NewsletterSignup';
7
8
 
8
9
  export default (config) => {
9
10
  return [
@@ -13,5 +14,6 @@ export default (config) => {
13
14
  installKeyFacts,
14
15
  installMaesViewer,
15
16
  installNavigation,
17
+ installNewsletter,
16
18
  ].reduce((acc, apply) => apply(acc), config);
17
19
  };
@@ -0,0 +1,354 @@
1
+ import React from 'react';
2
+ import { Transition } from 'semantic-ui-react';
3
+ import { Container, Grid, List, Icon, Accordion } from 'semantic-ui-react';
4
+
5
+ import { cloneDeep } from 'lodash';
6
+
7
+ import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
8
+
9
+ const createColumns = (item, length, renderMenuItem) => {
10
+ let subArrays = [];
11
+ let size = length;
12
+ for (let i = 0; i < item.items.length; i += size) {
13
+ subArrays.push(item.items.slice(i, i + size));
14
+ }
15
+
16
+ const column = subArrays.map((subArray, index) => (
17
+ <Grid.Column key={index}>
18
+ <List>
19
+ {subArray.map((arrayItem, idx) => (
20
+ <React.Fragment key={idx}>
21
+ {renderMenuItem(arrayItem, {
22
+ className: 'item',
23
+ role: 'listitem',
24
+ key: idx,
25
+ })}
26
+ </React.Fragment>
27
+ ))}
28
+ </List>
29
+ </Grid.Column>
30
+ ));
31
+
32
+ return column;
33
+ };
34
+
35
+ const ItemGrid = ({
36
+ item,
37
+ columns,
38
+ length,
39
+ renderMenuItem,
40
+ withTitle = true,
41
+ }) => (
42
+ <>
43
+ {withTitle && renderMenuItem(item, { className: 'sub-title' })}
44
+ {item.items.length ? (
45
+ <Grid columns={columns}>
46
+ {createColumns(item, length, renderMenuItem)}
47
+ </Grid>
48
+ ) : null}
49
+ </>
50
+ );
51
+
52
+ const Item = ({ item, icon = false, iconName, renderMenuItem }) => (
53
+ <>
54
+ {renderMenuItem(item, { className: 'sub-title' })}
55
+ <List className="menu-list">
56
+ {item.items.map((listItem, index) => (
57
+ <React.Fragment key={index}>
58
+ {renderMenuItem(
59
+ listItem,
60
+ {
61
+ className: 'item',
62
+ key: index,
63
+ role: 'listitem',
64
+ },
65
+ { children: icon && <Icon className={iconName} /> },
66
+ )}
67
+ </React.Fragment>
68
+ ))}
69
+ </List>
70
+ </>
71
+ );
72
+
73
+ const Topics = ({ menuItem, renderMenuItem }) => (
74
+ <Grid>
75
+ {menuItem.items.map((section, index) => (
76
+ <React.Fragment key={index}>
77
+ {section.title === 'At a glance' ? (
78
+ <Grid.Column width={3} id="at-a-glance">
79
+ <Item item={section} key={index} renderMenuItem={renderMenuItem} />
80
+ </Grid.Column>
81
+ ) : (
82
+ <Grid.Column width={9} key={index} id="topics-right-column">
83
+ <ItemGrid
84
+ item={section}
85
+ columns={4}
86
+ length={10}
87
+ key={index}
88
+ renderMenuItem={renderMenuItem}
89
+ />
90
+ </Grid.Column>
91
+ )}
92
+ </React.Fragment>
93
+ ))}
94
+ </Grid>
95
+ );
96
+
97
+ const Countries = ({ menuItem, renderMenuItem }) => {
98
+ return (
99
+ <ItemGrid
100
+ item={menuItem}
101
+ columns={5}
102
+ length={7}
103
+ renderMenuItem={renderMenuItem}
104
+ withTitle={false}
105
+ />
106
+ );
107
+ };
108
+
109
+ const StandardMegaMenuGrid = ({ menuItem, renderMenuItem }) => (
110
+ <Grid columns={4}>
111
+ {menuItem.items.map((section, index) => (
112
+ <Grid.Column key={index}>
113
+ <Item item={section} renderMenuItem={renderMenuItem} />
114
+ </Grid.Column>
115
+ ))}
116
+ </Grid>
117
+ );
118
+
119
+ const FirstLevelContent = ({ element, renderMenuItem, pathName }) => {
120
+ const topics = element.title === 'Topics' ? true : false;
121
+ let defaultIndex = -1;
122
+
123
+ return (
124
+ <>
125
+ {!topics ? (
126
+ <React.Fragment>
127
+ {element.items.map((item, index) => {
128
+ let firstLevelPanels = [];
129
+ if (!item.items.length) {
130
+ return (
131
+ <React.Fragment key={index}>
132
+ {renderMenuItem(item, { className: 'item sub-title' })}
133
+ </React.Fragment>
134
+ );
135
+ }
136
+ let x = {};
137
+ x.key = item['@id'] || item['url'];
138
+ if (pathName.indexOf(item.url) !== -1) {
139
+ defaultIndex = index;
140
+ }
141
+ x.title = (
142
+ <Accordion.Title key={`title=${index}`} as="button">
143
+ {item.title}
144
+ <Icon className="ri-arrow-down-s-line" size="small" />
145
+ </Accordion.Title>
146
+ );
147
+ let overflow_item = cloneDeep(item);
148
+ overflow_item.title = 'See all';
149
+ x.content = (
150
+ <Accordion.Content>
151
+ {renderMenuItem(overflow_item, {
152
+ className: 'item title-item',
153
+ })}
154
+ <SecondLevelContent
155
+ element={item}
156
+ renderMenuItem={renderMenuItem}
157
+ />
158
+ </Accordion.Content>
159
+ );
160
+ firstLevelPanels.push(x);
161
+ return (
162
+ <Accordion.Accordion
163
+ panels={firstLevelPanels}
164
+ key={index}
165
+ defaultActiveIndex={defaultIndex === index ? 0 : -1}
166
+ />
167
+ );
168
+ })}
169
+ </React.Fragment>
170
+ ) : (
171
+ <SecondLevelContent
172
+ element={element}
173
+ topics={true}
174
+ renderMenuItem={renderMenuItem}
175
+ />
176
+ )}
177
+ </>
178
+ );
179
+ };
180
+
181
+ const SecondLevelContent = ({ element, topics = false, renderMenuItem }) => {
182
+ let content;
183
+ if (topics) {
184
+ const atAGlance = element.items.find(
185
+ (element) => element.title === 'At a glance',
186
+ );
187
+ const inDepth = element.items.find(
188
+ (element) => element.url.indexOf('in-depth') !== -1,
189
+ );
190
+ content = (
191
+ <List>
192
+ {atAGlance &&
193
+ atAGlance.items.map((item, index) => (
194
+ <React.Fragment key={index}>
195
+ {renderMenuItem(item, {
196
+ key: index,
197
+ role: 'listitem',
198
+ className: 'item',
199
+ })}
200
+ </React.Fragment>
201
+ ))}
202
+ {inDepth && (
203
+ <React.Fragment key={inDepth.url}>
204
+ {renderMenuItem(inDepth, {
205
+ key: inDepth.url,
206
+ role: 'listitem',
207
+ className: 'item',
208
+ })}
209
+ </React.Fragment>
210
+ )}
211
+ </List>
212
+ );
213
+ } else {
214
+ content = (
215
+ <List>
216
+ {element.items.map((item, index) => (
217
+ <React.Fragment key={index}>
218
+ {renderMenuItem(item, {
219
+ key: index,
220
+ role: 'listitem',
221
+ className: 'item',
222
+ })}
223
+ </React.Fragment>
224
+ ))}
225
+ </List>
226
+ );
227
+ }
228
+
229
+ return <>{content}</>;
230
+ };
231
+
232
+ const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
233
+ let defaultIndex = -1;
234
+ const rootPanels = [];
235
+ menuItems.forEach((element, index) => {
236
+ let x = {};
237
+ x.key = index;
238
+
239
+ if (pathName.indexOf(element.url) !== -1) {
240
+ defaultIndex = index;
241
+ }
242
+ x.title = (
243
+ <Accordion.Title key={`title-${index}`} index={index} as="button">
244
+ {element.title}
245
+ <Icon className="ri-arrow-down-s-line" size="small" />
246
+ </Accordion.Title>
247
+ );
248
+ let overview = cloneDeep(element);
249
+ x.content = (
250
+ <Accordion.Content key={index}>
251
+ <div className="mega-menu-title">
252
+ {/* Inverted right labeled button as a category title - Mobile */}
253
+ {renderMenuItem(
254
+ overview,
255
+ { className: 'ui button inverted icon right labeled' },
256
+ {
257
+ iconPosition: 'right',
258
+ children: (
259
+ <>
260
+ {/* Add word overview to titles */}
261
+ <span> overview</span>
262
+ <Icon className={'arrow right icon'} alt={'Title icon'} />
263
+ </>
264
+ ),
265
+ },
266
+ )}
267
+ </div>
268
+ <FirstLevelContent
269
+ element={element}
270
+ renderMenuItem={renderMenuItem}
271
+ pathName={pathName}
272
+ />
273
+ </Accordion.Content>
274
+ );
275
+ rootPanels.push(x);
276
+ });
277
+
278
+ return <Accordion defaultActiveIndex={defaultIndex} panels={rootPanels} />;
279
+ };
280
+
281
+ function HeaderMenuPopUp({
282
+ menuItems,
283
+ renderMenuItem,
284
+ pathName,
285
+ onClose,
286
+ triggerRefs,
287
+ activeItem,
288
+ visible,
289
+ }) {
290
+ const nodeRef = React.useRef();
291
+ useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
292
+
293
+ const menuItem = menuItems.find(
294
+ (current) => current.url === activeItem || current['@id'] === activeItem,
295
+ );
296
+
297
+ return (
298
+ <Transition visible={visible} animation="slide down" duration={300}>
299
+ <div id="mega-menu" ref={nodeRef}>
300
+ <Container>
301
+ {menuItem && (
302
+ <div className="menu-content tablet hidden mobile hidden">
303
+ {/* Inverted right labeled button as a category title,
304
+ for topics the button goes inside the grid */}
305
+ {menuItem.title && (
306
+ <div className="mega-menu-title">
307
+ {renderMenuItem(
308
+ menuItem,
309
+ { className: 'ui button inverted icon right labeled' },
310
+ {
311
+ iconPosition: 'right',
312
+ children: (
313
+ <>
314
+ {/* Add word overview to titles */}
315
+ <span> overview</span>
316
+ <Icon
317
+ className={'arrow right icon'}
318
+ alt={'Title icon'}
319
+ />
320
+ </>
321
+ ),
322
+ },
323
+ )}
324
+ </div>
325
+ )}
326
+ {menuItem.title === 'Topics' ? (
327
+ <Topics menuItem={menuItem} renderMenuItem={renderMenuItem} />
328
+ ) : menuItem.title === 'Countries' ? (
329
+ <Countries
330
+ menuItem={menuItem}
331
+ renderMenuItem={renderMenuItem}
332
+ />
333
+ ) : (
334
+ <StandardMegaMenuGrid
335
+ menuItem={menuItem}
336
+ renderMenuItem={renderMenuItem}
337
+ />
338
+ )}
339
+ </div>
340
+ )}
341
+ <div className="tablet only mobile only">
342
+ <NestedAccordion
343
+ menuItems={menuItems}
344
+ renderMenuItem={renderMenuItem}
345
+ pathName={pathName}
346
+ />
347
+ </div>
348
+ </Container>
349
+ </div>
350
+ </Transition>
351
+ );
352
+ }
353
+
354
+ export default HeaderMenuPopUp;
@@ -0,0 +1,70 @@
1
+ import React, { useEffect, useMemo } from 'react';
2
+ import cx from 'classnames';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+
5
+ import config from '@plone/volto/registry';
6
+ import { BodyClass, flattenToAppURL } from '@plone/volto/helpers';
7
+ import { isSubsiteRoot } from 'volto-subsites/utils';
8
+ import { setSubsite } from 'volto-subsites/actions';
9
+
10
+ const SubsiteClass = () => {
11
+ const dispatch = useDispatch();
12
+ const content = useSelector((state) => state.content?.data);
13
+ const _subsite = useMemo(
14
+ () => content?.data?.['@components']?.subsite || {},
15
+ [content],
16
+ );
17
+ const pathname = useMemo(() => flattenToAppURL(content?.['@id']) || '', [
18
+ content,
19
+ ]);
20
+
21
+ const { eea, bise } = config.settings;
22
+ const { subsites, multilingualSubsites } = bise || {};
23
+
24
+ const subsite = useMemo(() => {
25
+ for (const subsite of subsites) {
26
+ const subsiteRe = new RegExp(`^(${subsite['@id']})(.*)`, 'g');
27
+ const isMultilingual = multilingualSubsites.includes(subsite['@id']);
28
+ let isRoot = isSubsiteRoot(pathname, subsite);
29
+
30
+ if (isMultilingual) {
31
+ for (const language of eea.languages) {
32
+ const multilingualSubsiteRe = new RegExp(
33
+ `^(${subsite['@id']})(/${language.code}($|/))$`,
34
+ 'g',
35
+ );
36
+ if (!!pathname.match(multilingualSubsiteRe)) {
37
+ isRoot = true;
38
+ break;
39
+ }
40
+ }
41
+ }
42
+
43
+ if (!!pathname.match(subsiteRe)) {
44
+ return {
45
+ ...subsite,
46
+ isMultilingual,
47
+ isRoot,
48
+ };
49
+ }
50
+ }
51
+ return _subsite;
52
+ }, [pathname, _subsite, subsites, multilingualSubsites, eea.languages]);
53
+
54
+ const subsiteClass = subsite.subsite_css_class?.token;
55
+
56
+ useEffect(() => {
57
+ dispatch(setSubsite(subsite));
58
+ }, [dispatch, subsite]);
59
+
60
+ return (
61
+ <BodyClass
62
+ className={cx({
63
+ subsite: subsite?.['@type'] === 'Subsite',
64
+ [`subsite-${subsiteClass}`]: !!subsiteClass,
65
+ 'subsite-root': subsite.isRoot,
66
+ })}
67
+ />
68
+ );
69
+ };
70
+ export default SubsiteClass;