@eeacms/volto-marine-policy 1.0.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 (154) hide show
  1. package/.coverage.babel.config.js +9 -0
  2. package/.eslintrc.js +65 -0
  3. package/.husky/pre-commit +2 -0
  4. package/.release-it.json +17 -0
  5. package/CHANGELOG.md +5 -0
  6. package/DEVELOP.md +53 -0
  7. package/DEVELOP.md.tpl +106 -0
  8. package/Jenkinsfile.tpl +416 -0
  9. package/LICENSE.md +9 -0
  10. package/Makefile.tpl +165 -0
  11. package/README.md +172 -0
  12. package/README.md.tpl +93 -0
  13. package/RELEASE.md +74 -0
  14. package/babel.config.js +17 -0
  15. package/bootstrap +41 -0
  16. package/cypress.config.js +24 -0
  17. package/docker-compose.yml +32 -0
  18. package/jest-addon.config.js +35 -0
  19. package/jest-addon.config.js.tpl +51 -0
  20. package/jest.setup.js +65 -0
  21. package/locales/de/LC_MESSAGES/volto.po +14 -0
  22. package/locales/en/LC_MESSAGES/volto.po +14 -0
  23. package/locales/it/LC_MESSAGES/volto.po +14 -0
  24. package/locales/ro/LC_MESSAGES/volto.po +14 -0
  25. package/locales/volto.pot +16 -0
  26. package/package.json +68 -0
  27. package/package.json.tpl +70 -0
  28. package/razzle.extend.js +29 -0
  29. package/src/components/Blocks/CustomBlockTemplates/customBlockTemplates.js +25 -0
  30. package/src/components/Blocks/MsfdDataExplorerBlock/Edit.jsx +29 -0
  31. package/src/components/Blocks/MsfdDataExplorerBlock/View.jsx +105 -0
  32. package/src/components/Blocks/MsfdDataExplorerBlock/index.js +23 -0
  33. package/src/components/Blocks/MsfdDataExplorerBlock/schema.jsx +30 -0
  34. package/src/components/Result/MarineMeasureItem.jsx +83 -0
  35. package/src/components/Widgets/MeasureViewWidget.jsx +233 -0
  36. package/src/components/Widgets/String.jsx +15 -0
  37. package/src/components/Widgets/TextAlign.jsx +41 -0
  38. package/src/components/Widgets/measure.css +101 -0
  39. package/src/components/index.js +15 -0
  40. package/src/components/theme/AppExtras/PrintPage/PrintPage.jsx +61 -0
  41. package/src/components/theme/AppExtras/PrintPage/css/printpage.less +29 -0
  42. package/src/components/theme/AppExtras/PrintPage/index.js +3 -0
  43. package/src/components/theme/AppExtras/ScrollToTop/ScrollToTop.jsx +61 -0
  44. package/src/components/theme/AppExtras/ScrollToTop/css/scrolltop.less +19 -0
  45. package/src/components/theme/AppExtras/ScrollToTop/index.js +3 -0
  46. package/src/components/theme/AppExtras/index.js +18 -0
  47. package/src/components/theme/DatabaseItemView/DatabaseItemView.jsx +39 -0
  48. package/src/components/theme/DatabaseItemView/style.less +87 -0
  49. package/src/components/theme/Header/HeroSection.jsx +45 -0
  50. package/src/components/theme/Header/StickyHeader.jsx +51 -0
  51. package/src/components/theme/Header/less/globals.less +18 -0
  52. package/src/components/theme/Header/less/herosection.less +64 -0
  53. package/src/components/theme/Header/less/herosection.variables +18 -0
  54. package/src/components/theme/ItemMetadata/ItemMetadata.jsx +217 -0
  55. package/src/components/theme/ItemMetadata/ItemMetadataSnippet.jsx +69 -0
  56. package/src/components/theme/ItemMetadata/ItemTitle.jsx +29 -0
  57. package/src/components/theme/MetadataListingView/MapPreview.jsx +105 -0
  58. package/src/components/theme/MetadataListingView/MetadataHeader.jsx +66 -0
  59. package/src/components/theme/MetadataListingView/MetadataListingView.jsx +36 -0
  60. package/src/components/theme/MetadataListingView/style.less +219 -0
  61. package/src/components/theme/SimpleListingView/SimpleListingView.jsx +97 -0
  62. package/src/components/theme/SimpleListingView/style.less +33 -0
  63. package/src/components/theme/Tableau/TableauDownload.jsx +86 -0
  64. package/src/components/theme/Tableau/TableauFullscreen.jsx +78 -0
  65. package/src/components/theme/Tableau/TableauShare.jsx +128 -0
  66. package/src/components/theme/View/FullwidthView.jsx +102 -0
  67. package/src/components/theme/View/HeroSectionView.jsx +125 -0
  68. package/src/constants/ActionTypes.js +12 -0
  69. package/src/constants/measureFields.js +56 -0
  70. package/src/customizations/@eeacms/volto-block-style/StyleWrapper/schema.js +217 -0
  71. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +358 -0
  72. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +403 -0
  73. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +131 -0
  74. package/src/customizations/@eeacms/volto-eea-design-system/ui/Logo/Logo.jsx +32 -0
  75. package/src/customizations/@eeacms/volto-eea-design-system/ui/Logo/marine_logo.svg +63 -0
  76. package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +81 -0
  77. package/src/customizations/volto/components/manage/Contents/README.md +1 -0
  78. package/src/customizations/volto/components/manage/Toolbar/PersonalTools.jsx +205 -0
  79. package/src/customizations/volto/components/manage/Toolbar/Toolbar.jsx +624 -0
  80. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +49 -0
  81. package/src/customizations/volto/components/theme/Breadcrumbs/README.md +1 -0
  82. package/src/customizations/volto/components/theme/Header/Header.jsx +272 -0
  83. package/src/helpers/index.js +2 -0
  84. package/src/helpers/useCopyToClipboard.js +25 -0
  85. package/src/helpers/useOutsideClick.js +20 -0
  86. package/src/icons/arrow.svg +3 -0
  87. package/src/icons/basket.svg +3 -0
  88. package/src/icons/newspaper.svg +3 -0
  89. package/src/icons/popup.svg +3 -0
  90. package/src/icons/search.svg +3 -0
  91. package/src/icons/star-full.svg +3 -0
  92. package/src/icons/user.svg +3 -0
  93. package/src/index.js +466 -0
  94. package/src/reducers/breadcrumb/breadcrumb.js +59 -0
  95. package/src/reducers/index.js +2 -0
  96. package/src/reducers/localnavigation/localnavigation.js +69 -0
  97. package/src/search/config.js +98 -0
  98. package/src/search/facets.js +85 -0
  99. package/src/search/index.js +48 -0
  100. package/src/search/views.js +15 -0
  101. package/src/slate-styles.less +43 -0
  102. package/src/static/bise_logo.svg +1 -0
  103. package/src/static/cca_logo.svg +20 -0
  104. package/src/static/ec_logo.svg +343 -0
  105. package/src/static/ec_logo_white.svg +10 -0
  106. package/src/static/eea_logo.svg +14 -0
  107. package/src/static/footer-fishes.svg +21 -0
  108. package/src/static/forest_logo.svg +30 -0
  109. package/src/static/freshwater_logo.svg +12 -0
  110. package/src/static/marine_logo.svg +63 -0
  111. package/src/static/marine_logo_white.svg +44 -0
  112. package/src/utils.js +38 -0
  113. package/theme/assets/fonts/Poppins/Poppins-Bold.ttf +0 -0
  114. package/theme/assets/fonts/Poppins/Poppins-Bold.woff +0 -0
  115. package/theme/assets/fonts/Poppins/Poppins-Bold.woff2 +0 -0
  116. package/theme/assets/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
  117. package/theme/assets/fonts/Poppins/Poppins-Light.ttf +0 -0
  118. package/theme/assets/fonts/Poppins/Poppins-Light.woff +0 -0
  119. package/theme/assets/fonts/Poppins/Poppins-Light.woff2 +0 -0
  120. package/theme/assets/fonts/Poppins/Poppins-Regular.ttf +0 -0
  121. package/theme/assets/fonts/Poppins/Poppins-Regular.woff +0 -0
  122. package/theme/assets/fonts/Poppins/Poppins-Regular.woff2 +0 -0
  123. package/theme/assets/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
  124. package/theme/assets/fonts/Poppins/Poppins-SemiBold.woff +0 -0
  125. package/theme/assets/fonts/Poppins/Poppins-SemiBold.woff2 +0 -0
  126. package/theme/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  127. package/theme/assets/fonts/Roboto/Roboto-Light.woff +0 -0
  128. package/theme/assets/fonts/Roboto/Roboto-Light.woff2 +0 -0
  129. package/theme/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  130. package/theme/assets/fonts/Roboto/Roboto-Medium.woff +0 -0
  131. package/theme/assets/fonts/Roboto/Roboto-Medium.woff2 +0 -0
  132. package/theme/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  133. package/theme/assets/fonts/Roboto/Roboto-Regular.woff +0 -0
  134. package/theme/assets/fonts/Roboto/Roboto-Regular.woff2 +0 -0
  135. package/theme/assets/images/Footer/ec_logo.svg +10 -0
  136. package/theme/assets/images/Header/climate-adapt-logo-1.svg +20 -0
  137. package/theme/assets/images/Header/climate-adapt-logo.svg +22 -0
  138. package/theme/assets/images/spinner.svg +1 -0
  139. package/theme/collections/table.variables +17 -0
  140. package/theme/elements/button.overrides +22 -0
  141. package/theme/extras/banner.variables +5 -0
  142. package/theme/extras/contextNavigation.overrides +60 -0
  143. package/theme/extras/contextNavigation.variables +32 -0
  144. package/theme/extras/footer.variables +6 -0
  145. package/theme/extras/header.overrides +20 -0
  146. package/theme/extras/header.variables +7 -0
  147. package/theme/extras/hero.overrides +4 -0
  148. package/theme/extras/inpageNavigation.variables +5 -0
  149. package/theme/extras/mixins.less +8 -0
  150. package/theme/globals/site.overrides +349 -0
  151. package/theme/globals/site.variables +997 -0
  152. package/theme/theme.config +136 -0
  153. package/theme/tokens/colors.less +9 -0
  154. package/theme/tokens/tokens.less +1 -0
@@ -0,0 +1,217 @@
1
+ import config from '@plone/volto/registry';
2
+
3
+ export const StyleSchema = () => {
4
+ return {
5
+ title: 'Styles',
6
+ fieldsets: [
7
+ {
8
+ id: 'default',
9
+ title: 'Default',
10
+ fields: [],
11
+ },
12
+ {
13
+ id: 'presets',
14
+ title: 'Preset styles',
15
+ fields: ['style_name'],
16
+ },
17
+ {
18
+ id: 'standard',
19
+ title: 'Standard',
20
+ fields: [
21
+ 'textAlign',
22
+ 'fontSize',
23
+ 'fontWeight',
24
+ 'align',
25
+ 'stretch',
26
+ 'size',
27
+ 'isDropCap',
28
+ ],
29
+ },
30
+ {
31
+ id: 'decorations',
32
+ title: 'Decorations',
33
+ fields: [
34
+ 'backgroundImage',
35
+ 'backgroundColor',
36
+ 'textColor',
37
+ 'borderRadius',
38
+ 'shadowDepth',
39
+ 'shadowColor',
40
+ ],
41
+ },
42
+ {
43
+ id: 'layout',
44
+ title: 'Layout',
45
+ fields: ['margin', 'padding', 'size', 'align', 'stretch'], // todo: width, conflicts with size
46
+ },
47
+ {
48
+ id: 'advanced',
49
+ title: 'Advanced',
50
+ fields: [
51
+ 'useAsPageHeader',
52
+ 'theme',
53
+ 'hidden',
54
+ 'height',
55
+ 'isScreenHeight',
56
+ 'customClass',
57
+ 'customId',
58
+ 'clear',
59
+ ],
60
+ },
61
+ ],
62
+ properties: {
63
+ theme: {
64
+ title: 'Theme',
65
+ description: 'A predefined theme, applicable just to this block',
66
+ widget: 'theme_picker',
67
+ colors: [
68
+ ...(config.settings && config.settings.themeColors
69
+ ? config.settings.themeColors.map(({ value, title }) => ({
70
+ name: value,
71
+ label: title,
72
+ }))
73
+ : []),
74
+ ],
75
+ },
76
+ style_name: {
77
+ title: 'Style',
78
+ widget: 'style_select',
79
+ },
80
+ textAlign: {
81
+ title: 'Text align',
82
+ widget: 'style_text_align',
83
+ },
84
+ align: {
85
+ title: 'Align',
86
+ widget: 'style_align',
87
+ },
88
+ stretch: {
89
+ title: 'Stretch',
90
+ widget: 'style_stretch',
91
+ },
92
+ fontSize: {
93
+ title: 'Font size',
94
+ description: 'Relative to normal size of text in the block',
95
+ choices: [
96
+ ['xx-small', 'xx-small'],
97
+ ['x-small', 'x-small'],
98
+ ['small', 'small'],
99
+ ['medium', 'medium'],
100
+ ['large', 'large'],
101
+ ['x-large', 'x-large'],
102
+ ['xx-large', 'xx-large'],
103
+ ['xxx-large', 'xxx-large'],
104
+ ],
105
+ },
106
+ fontWeight: {
107
+ title: 'Font weight',
108
+ description: 'The weight (or boldness) of the font',
109
+ choices: [
110
+ ['300', 'Light'],
111
+ ['400', 'Regular'],
112
+ ['500', 'Medium'],
113
+ ['600', 'SemiBold'],
114
+ ['700', 'Bold'],
115
+ ],
116
+ },
117
+ margin: {
118
+ title: 'Margin',
119
+ widget: 'quad_size',
120
+ },
121
+ padding: {
122
+ title: 'Padding',
123
+ widget: 'quad_size',
124
+ },
125
+ size: {
126
+ title: 'Box size',
127
+ widget: 'style_size',
128
+ },
129
+ height: {
130
+ title: 'Element height',
131
+ widget: 'text',
132
+ description: 'Element height, expressed as CSS dimension',
133
+ },
134
+ isScreenHeight: {
135
+ title: 'Screen height',
136
+ description: 'Maximize block to viewport height',
137
+ type: 'boolean',
138
+ },
139
+ backgroundImage: {
140
+ title: 'Background image',
141
+ widget: 'url',
142
+ },
143
+ backgroundColor: {
144
+ title: 'Background color',
145
+ type: 'color',
146
+ widget: 'style_simple_color',
147
+ available_colors: config.settings.available_colors,
148
+ },
149
+ textColor: {
150
+ title: 'Text color',
151
+ type: 'color',
152
+ widget: 'style_simple_color',
153
+ available_colors: config.settings.available_colors,
154
+ },
155
+ customClass: {
156
+ title: 'Custom CSS Class',
157
+ description: 'A custom CSS class, applicable just to this block',
158
+ },
159
+ customId: {
160
+ title: 'Custom Id',
161
+ description: 'A custom id, applicable just to this block',
162
+ },
163
+ isDropCap: {
164
+ title: 'Drop cap',
165
+ description: 'First letter is styled as a drop cop',
166
+ type: 'boolean',
167
+ },
168
+ hidden: {
169
+ title: 'Hidden',
170
+ description: 'Hide this block',
171
+ type: 'boolean',
172
+ },
173
+ useAsPageHeader: {
174
+ title: 'Use as page header',
175
+ description: 'Use this block as page header',
176
+ type: 'boolean',
177
+ },
178
+ shadowDepth: {
179
+ widget: 'slider',
180
+ title: 'Shadow depth',
181
+ settings: {
182
+ min: 0,
183
+ max: 24,
184
+ step: 1,
185
+ start: 0,
186
+ },
187
+ },
188
+ shadowColor: {
189
+ title: 'Shadow color',
190
+ type: 'color',
191
+ widget: 'style_simple_color',
192
+ available_colors: config.settings.available_colors,
193
+ },
194
+ borderRadius: {
195
+ widget: 'slider',
196
+ title: 'Rounded Corner',
197
+ settings: {
198
+ min: 0,
199
+ max: 24,
200
+ step: 1,
201
+ start: 0,
202
+ },
203
+ },
204
+ clear: {
205
+ title: 'Clear floats',
206
+ description: 'Pushes selected block under floated content',
207
+ choices: [
208
+ [null, 'None'],
209
+ ['left', 'Left'],
210
+ ['right', 'Right'],
211
+ ['both', 'Both'],
212
+ ],
213
+ },
214
+ },
215
+ required: [],
216
+ };
217
+ };
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Header component.
3
+ * @module components/theme/Header/Header
4
+ */
5
+
6
+ import React from 'react'; // , { Component }
7
+ import { useHistory } from 'react-router-dom';
8
+ import cx from 'classnames';
9
+ import { Container, Menu, Grid, Dropdown } from 'semantic-ui-react'; // Dropdown,
10
+ import { LazyLoadImage } from 'react-lazy-load-image-component';
11
+
12
+ import closeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/close-line.svg';
13
+ import searchIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/search-line.svg';
14
+ import burgerIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/menu-line.svg';
15
+
16
+ import HeaderSearchPopUp from '@eeacms/volto-marine-policy/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp';
17
+ import HeaderMenuPopUp from '@eeacms/volto-marine-policy/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp';
18
+ import PropTypes from 'prop-types';
19
+
20
+ import { isInternalURL } from '@plone/volto/helpers';
21
+ import config from '@plone/volto/registry';
22
+
23
+ Header.propTypes = {
24
+ transparency: PropTypes.bool,
25
+ inverted: PropTypes.bool,
26
+ };
27
+
28
+ function Header({ children }) {
29
+ return <div className="eea header">{children}</div>;
30
+ }
31
+
32
+ const TopHeader = ({ children }) => (
33
+ <div className="top bar">
34
+ <Container>{children}</Container>
35
+ </div>
36
+ );
37
+
38
+ const TopItem = ({ children, className, id }) => (
39
+ <div className={cx('item', 'header-top-item', className)} id={id}>
40
+ {children}
41
+ </div>
42
+ );
43
+
44
+ const TopDropdownMenu = ({
45
+ children,
46
+ className,
47
+ icon,
48
+ hasLanguageDropdown = false,
49
+ id,
50
+ tabletText,
51
+ mobileText,
52
+ text,
53
+ viewportWidth,
54
+ }) => {
55
+ const isTablet = viewportWidth < 991;
56
+ const isMobile = viewportWidth < 767;
57
+
58
+ const Component = ({ mobileText }) => {
59
+ return (
60
+ <>
61
+ {children.props['aria-label'] === 'language switcher' ? (
62
+ hasLanguageDropdown && (
63
+ <Dropdown
64
+ id={id}
65
+ className={className}
66
+ text={mobileText || text}
67
+ icon={icon || 'chevron down'}
68
+ aria-label="dropdown"
69
+ role="dropdown"
70
+ lazyLoad
71
+ closeOnChange={true}
72
+ closeOnBlur={false}
73
+ closeOnEscape={true}
74
+ >
75
+ <Dropdown.Menu role="option">{children}</Dropdown.Menu>
76
+ </Dropdown>
77
+ )
78
+ ) : (
79
+ <Dropdown
80
+ id={id}
81
+ className={className}
82
+ text={mobileText || text}
83
+ icon={icon || 'chevron down'}
84
+ role="dropdown"
85
+ aria-label="dropdown"
86
+ lazyLoad
87
+ closeOnChange={true}
88
+ closeOnBlur={false}
89
+ closeOnEscape={true}
90
+ >
91
+ <Dropdown.Menu role="option">{children}</Dropdown.Menu>
92
+ </Dropdown>
93
+ )}
94
+ </>
95
+ );
96
+ };
97
+ return (
98
+ <>
99
+ {isMobile ? (
100
+ <Component mobileText={mobileText} />
101
+ ) : isTablet ? (
102
+ <Component mobileText={tabletText} />
103
+ ) : (
104
+ <Component />
105
+ )}
106
+ </>
107
+ );
108
+ };
109
+
110
+ const Main = ({
111
+ logo,
112
+ menuItems,
113
+ menuItemsLayouts,
114
+ renderMenuItem,
115
+ renderGlobalMenuItem,
116
+ headerSearchBox,
117
+ pathname,
118
+ transparency,
119
+ inverted,
120
+ hideSearch,
121
+ isMultilingual,
122
+ }) => {
123
+ const history = useHistory();
124
+ const [activeItem, setActiveItem] = React.useState(pathname);
125
+ const [menuIsActive, setMenuIsActive] = React.useState(false);
126
+ const [searchIsActive, setSearchIsActive] = React.useState(false);
127
+ const [burger, setBurger] = React.useState('');
128
+ const searchInputRef = React.useRef(null);
129
+ const [isClient, setIsClient] = React.useState();
130
+ const itemsLayouts = menuItemsLayouts || config.settings?.menuItemsLayouts;
131
+
132
+ React.useEffect(() => setIsClient(true), []);
133
+
134
+ React.useEffect(() => {
135
+ setMenuIsActive(false);
136
+ setSearchIsActive(false);
137
+ setBurger('');
138
+ // remove active menu when we have no pathname which means we hit logo to go home
139
+ //remove the lang route in order to check if empty
140
+ //setActiveItem as pathname when pathname changed
141
+ if (
142
+ !pathname ||
143
+ (isMultilingual === true && !pathname?.split('/')?.slice(2)?.join('/'))
144
+ ) {
145
+ setActiveItem('');
146
+ } else setActiveItem(pathname);
147
+ }, [isMultilingual, pathname]);
148
+
149
+ React.useEffect(() => {
150
+ if (searchIsActive) {
151
+ searchInputRef.current && searchInputRef.current.focus();
152
+ }
153
+ }, [searchIsActive]);
154
+
155
+ const searchOnClick = (e, x) => {
156
+ if (menuIsActive === true) {
157
+ setBurger('');
158
+ setMenuIsActive(false);
159
+ setActiveItem('');
160
+ }
161
+ setSearchIsActive(!searchIsActive);
162
+ };
163
+
164
+ const mobileBurgerOnClick = () => {
165
+ if (searchIsActive === true) {
166
+ setSearchIsActive(false);
167
+ }
168
+
169
+ if (burger === '') {
170
+ setBurger('open');
171
+ setMenuIsActive(true);
172
+ } else {
173
+ setBurger('');
174
+ setMenuIsActive(false);
175
+ setActiveItem('');
176
+ }
177
+ };
178
+
179
+ const menuOnClickOutside = () => {
180
+ // restore active element if nothing was selected from the menu dropdown
181
+ if (pathname !== activeItem) {
182
+ setActiveItem(pathname);
183
+ }
184
+ // close mobile navigation when clicking outside if we have value for nav
185
+ if (burger) {
186
+ setBurger('');
187
+ }
188
+ // always close the menu
189
+ setMenuIsActive(false);
190
+ };
191
+
192
+ const menuOnClick = (e, item) => {
193
+ if (searchIsActive) setSearchIsActive(false);
194
+ setActiveItem(item['@id'] || item.url);
195
+ if (item.items.length) {
196
+ setMenuIsActive(true);
197
+ } else {
198
+ if (isInternalURL(item.url)) {
199
+ history.push(item.url);
200
+ } else if (isClient) {
201
+ window.location.replace(item.url);
202
+ }
203
+ }
204
+ };
205
+
206
+ // Listens for escape keydown event
207
+ React.useEffect(() => {
208
+ const escKeyPressed = (e) => {
209
+ if (e.key === 'Escape') {
210
+ // menuOnClickOutside();
211
+ // restore active element if nothing was selected from the menu dropdown
212
+ if (pathname !== activeItem) {
213
+ setActiveItem(pathname);
214
+ }
215
+ // close mobile navigation when clicking outside if we have value for nav
216
+ if (burger) {
217
+ setBurger('');
218
+ }
219
+ // always close the menu & search
220
+ setMenuIsActive(false);
221
+ setSearchIsActive(false);
222
+ }
223
+ };
224
+
225
+ document.addEventListener('keydown', escKeyPressed);
226
+
227
+ return () => {
228
+ document.removeEventListener('keydown', escKeyPressed);
229
+ };
230
+ }, [activeItem, burger, pathname]);
231
+
232
+ // React.useEffect(() => {
233
+ // if (searchIsActive || burger === 'open' || menuIsActive) {
234
+ // document.body.style.overflow = 'hidden';
235
+ // } else {
236
+ // document.body.style.overflow = 'unset';
237
+ // }
238
+ // }, [searchIsActive, burger, menuIsActive]);
239
+
240
+ const node = React.useRef();
241
+ const searchButtonRef = React.useRef();
242
+ const mobileMenuBurgerRef = React.useRef();
243
+ const desktopMenuRef = React.useRef();
244
+
245
+ // disable sticky setting until feature is more stable
246
+ // const isScrollingUp = useScrollingUp();
247
+ // <div
248
+ // className={`main bar ${transparency ? 'transparency' : ''} ${
249
+ // isScrollingUp ? 'sticky' : ''
250
+ // }`}
251
+ // >
252
+ return (
253
+ <div
254
+ className={`main bar ${transparency ? 'transparency' : ''}`}
255
+ ref={node}
256
+ >
257
+ <Container>
258
+ <Grid>
259
+ <Grid.Column mobile={8} tablet={8} computer={4}>
260
+ {logo}
261
+ </Grid.Column>
262
+ <Grid.Column mobile={4} tablet={4} computer={8}>
263
+ <div className={inverted ? 'main-menu inverted' : 'main-menu'}>
264
+ {menuItems && (
265
+ <ul
266
+ className="ui text eea-main-menu tablet or lower hidden menu"
267
+ ref={desktopMenuRef}
268
+ id={'navigation'}
269
+ >
270
+ {menuItems.map((item) => (
271
+ <Menu.Item
272
+ name={item['@id'] || item.url}
273
+ key={item['@id'] || item.url}
274
+ as={'li'}
275
+ active={
276
+ activeItem.indexOf(item['@id']) !== -1 ||
277
+ activeItem.indexOf(item.url) !== -1
278
+ }
279
+ >
280
+ {renderGlobalMenuItem(item, {
281
+ onClick: menuOnClick,
282
+ })}
283
+ </Menu.Item>
284
+ ))}
285
+ </ul>
286
+ )}
287
+ {!hideSearch && (
288
+ <button
289
+ className="search-action"
290
+ onClick={searchOnClick}
291
+ tabIndex="0"
292
+ aria-pressed="false"
293
+ aria-haspopup="true"
294
+ ref={searchButtonRef}
295
+ >
296
+ {/* <Icon name={!state.activeSearch ? 'search' : 'close'} /> */}
297
+ <LazyLoadImage
298
+ src={!searchIsActive ? `${searchIcon}` : `${closeIcon}`}
299
+ alt="search button open/close"
300
+ />
301
+ </button>
302
+ )}
303
+ <Header.BurgerAction
304
+ className={`mobile ${burger}`}
305
+ onClick={mobileBurgerOnClick}
306
+ ref={mobileMenuBurgerRef}
307
+ >
308
+ <LazyLoadImage
309
+ src={burger === 'open' ? `${closeIcon}` : `${burgerIcon}`}
310
+ alt="menu icon open/close"
311
+ />
312
+ </Header.BurgerAction>
313
+ </div>
314
+ </Grid.Column>
315
+ </Grid>
316
+ </Container>
317
+ {searchIsActive && (
318
+ <HeaderSearchPopUp
319
+ onClose={searchOnClick}
320
+ searchInputRef={searchInputRef}
321
+ triggerRefs={[searchButtonRef]}
322
+ headerSearchBox={headerSearchBox}
323
+ />
324
+ )}
325
+ <HeaderMenuPopUp
326
+ renderMenuItem={renderMenuItem}
327
+ activeItem={activeItem}
328
+ menuItems={menuItems}
329
+ menuItemsLayouts={itemsLayouts}
330
+ pathName={pathname}
331
+ onClose={menuOnClickOutside}
332
+ triggerRefs={[mobileMenuBurgerRef, desktopMenuRef]}
333
+ visible={menuIsActive}
334
+ />
335
+ </div>
336
+ );
337
+ };
338
+
339
+ const BurgerAction = React.forwardRef((props, ref) => (
340
+ <button
341
+ ref={ref}
342
+ className={`burger-action ${props.className}`}
343
+ tabIndex="0"
344
+ aria-pressed="false"
345
+ aria-haspopup="true"
346
+ onClick={props.onClick}
347
+ >
348
+ {props.children}
349
+ </button>
350
+ ));
351
+
352
+ Header.BurgerAction = BurgerAction;
353
+ Header.Main = Main;
354
+ Header.TopDropdownMenu = TopDropdownMenu;
355
+ Header.TopHeader = TopHeader;
356
+ Header.TopItem = TopItem;
357
+
358
+ export default Header;