@eeacms/volto-eea-website-theme 0.7.6 → 0.7.7

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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
+ ### [0.7.7](https://github.com/eea/volto-eea-website-theme/compare/0.7.6...0.7.7) - 19 October 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - feature(theme): added context copyright component [g-stamatis - [`ab4079c`](https://github.com/eea/volto-eea-website-theme/commit/ab4079c2be9bc7eff46f84ef83d552431f8e79bc)]
12
+ - Fix hardcoded search link [kreafox - [`c42d32e`](https://github.com/eea/volto-eea-website-theme/commit/c42d32eee8f1e0974da1526dccb8ac12e92d4bef)]
13
+ - Better handling of active view [kreafox - [`944ce20`](https://github.com/eea/volto-eea-website-theme/commit/944ce20fa3cc10beb02d05cf1f8261d3988520ac)]
7
14
  ### [0.7.6](https://github.com/eea/volto-eea-website-theme/compare/0.7.5...0.7.6) - 5 October 2022
8
15
 
9
16
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
package/src/config.js CHANGED
@@ -248,6 +248,21 @@ export const websiteTitle = 'Site';
248
248
  export const organisationName = 'European Environment Agency';
249
249
  export const logoTargetUrl = '/';
250
250
 
251
+ export const headerSearchBox = [
252
+ {
253
+ isDefault: true,
254
+ path: '/en/advanced-search',
255
+ placeholder: 'Search...',
256
+ },
257
+ {
258
+ path: '/en/datahub',
259
+ placeholder: 'Search Datahub...',
260
+ description:
261
+ 'Looking for more information? Try searching the full EEA website content',
262
+ buttonTitle: 'Go to full site search',
263
+ },
264
+ ];
265
+
251
266
  export const colors = [
252
267
  // Primary & shades
253
268
  '#007B6C',
@@ -2,14 +2,23 @@ import React from 'react';
2
2
  import { Container, Input } from 'semantic-ui-react';
3
3
  import { withRouter } from 'react-router-dom';
4
4
  import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
5
+ import config from '@plone/volto/registry';
5
6
 
6
7
  function HeaderSearchPopUp({
7
8
  history,
9
+ location,
8
10
  onClose,
9
11
  searchInputRef,
10
12
  triggerRefs = [],
11
13
  }) {
12
14
  const nodeRef = React.useRef();
15
+ const { eea } = config.settings;
16
+ const defaultView = eea.headerSearchBox.filter((v) => v.isDefault);
17
+ const localView = eea.headerSearchBox.filter((v) =>
18
+ location.pathname.includes(v.path),
19
+ );
20
+ const activeView = localView.length > 0 ? localView[0] : defaultView[0];
21
+
13
22
  const [text, setText] = React.useState('');
14
23
 
15
24
  useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
@@ -20,7 +29,7 @@ function HeaderSearchPopUp({
20
29
  };
21
30
 
22
31
  const onSubmit = (event) => {
23
- history.push(`/en/advanced-search?q=${text}`);
32
+ history.push(`${activeView.path}?q=${text}`);
24
33
 
25
34
  if (window?.searchContext?.resetSearch) {
26
35
  window.searchContext.resetSearch({ searchTerm: text });
@@ -31,24 +40,40 @@ function HeaderSearchPopUp({
31
40
  };
32
41
 
33
42
  return (
34
- <form id="search-box" ref={nodeRef} method="get" onSubmit={onSubmit}>
35
- <Container>
36
- <div className="wrapper">
37
- <Input
38
- ref={searchInputRef}
39
- className="search"
40
- onChange={onChangeText}
41
- icon={{
42
- className: 'ri-search-line',
43
- link: true,
44
- onClick: onSubmit,
45
- }}
46
- placeholder="Search..."
47
- fluid
48
- />
43
+ <div id="search-box" ref={nodeRef}>
44
+ <form method="get" onSubmit={onSubmit}>
45
+ <Container>
46
+ <div className="wrapper">
47
+ <Input
48
+ ref={searchInputRef}
49
+ className="search"
50
+ onChange={onChangeText}
51
+ icon={{
52
+ className: 'ri-search-line',
53
+ link: true,
54
+ onClick: onSubmit,
55
+ }}
56
+ placeholder={activeView.placeholder}
57
+ fluid
58
+ />
59
+ </div>
60
+ </Container>
61
+ </form>
62
+ {(activeView.description || activeView.buttonTitle) && (
63
+ <div className="advanced-search">
64
+ <Container>
65
+ <p>{activeView.description}</p>
66
+ <a
67
+ href={defaultView[0].path}
68
+ className="ui button white inverted"
69
+ title="Advanced search"
70
+ >
71
+ {activeView.buttonTitle}
72
+ </a>
73
+ </Container>
49
74
  </div>
50
- </Container>
51
- </form>
75
+ )}
76
+ </div>
52
77
  );
53
78
  }
54
79
 
@@ -109,6 +109,7 @@
109
109
  @callout : 'eea';
110
110
  @quote : 'eea';
111
111
  @hero : 'eea';
112
+ @copyright : 'eea';
112
113
 
113
114
  /*******************************
114
115
  Folders