@eeacms/volto-eea-website-theme 0.6.7 → 0.6.10

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,8 +4,39 @@ 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.6.10](https://github.com/eea/volto-eea-website-theme/compare/0.6.9...0.6.10)
8
+
9
+ - Use window.searchContext.resetSearch for search widget [`#41`](https://github.com/eea/volto-eea-website-theme/pull/41)
10
+ - change(header): add homepage class also on edit page [`0a10847`](https://github.com/eea/volto-eea-website-theme/commit/0a108477a3a15f9d0e2172286837ddfd94e078fa)
11
+ - Use window.searchContext.resetSearch [`c3a968b`](https://github.com/eea/volto-eea-website-theme/commit/c3a968b91646102dad461541a1501b93a653e2c9)
12
+ - fix(header): homepage is now true only on view page [`a0618a7`](https://github.com/eea/volto-eea-website-theme/commit/a0618a74431a280c3ccb95597d7f771385fac2eb)
13
+
14
+ #### [0.6.9](https://github.com/eea/volto-eea-website-theme/compare/0.6.8...0.6.9)
15
+
16
+ > 14 June 2022
17
+
18
+ - Add custom styles: Content Box [`#40`](https://github.com/eea/volto-eea-website-theme/pull/40)
19
+
20
+ #### [0.6.8](https://github.com/eea/volto-eea-website-theme/compare/0.6.7...0.6.8)
21
+
22
+ > 13 June 2022
23
+
24
+ - change(theme): added homepage and homepage inverted pages [`#39`](https://github.com/eea/volto-eea-website-theme/pull/39)
25
+ - Fix HomepageView typo [`41582a3`](https://github.com/eea/volto-eea-website-theme/commit/41582a39f8e84cd3ef62d9ef302798627e8350f1)
26
+ - fix import to please jslint [`b4a6555`](https://github.com/eea/volto-eea-website-theme/commit/b4a655548600ef9b9c8ecdd156d0062d4b54d00e)
27
+ - change(header): added homepage and homepage_inverse views [`6df68d7`](https://github.com/eea/volto-eea-website-theme/commit/6df68d7a592d623af76c1036c38d2c480fc6ce88)
28
+ - Fifty shades of gray [`9deae59`](https://github.com/eea/volto-eea-website-theme/commit/9deae599dc0e1431727067b281c32a58c1ac544c)
29
+ - Minimal search integration for Header popup [`14870df`](https://github.com/eea/volto-eea-website-theme/commit/14870df1b0d82d1e04955bfa8cc07c7b853737c6)
30
+ - Customize eea-design-system HeaderSearchPopUp. Copied unchanged [`4c9306c`](https://github.com/eea/volto-eea-website-theme/commit/4c9306c6afe4c62cbc74f3510339c4a6dbbd210a)
31
+ - Customize available colors in volto-block-style [`5c5adb5`](https://github.com/eea/volto-eea-website-theme/commit/5c5adb541b3e7d84daf110e9eab7ec7950e0e989)
32
+ - change(theme): set draft bg to the content-area instead of the body area [`33be595`](https://github.com/eea/volto-eea-website-theme/commit/33be595a353afc570f8887c3bf55f6482c573fd8)
33
+ - change(header): add homepage class to plone site [`c6f912b`](https://github.com/eea/volto-eea-website-theme/commit/c6f912b59f288e7ddb4679f2a3b7011c6ce02c8c)
34
+
7
35
  #### [0.6.7](https://github.com/eea/volto-eea-website-theme/compare/0.6.6...0.6.7)
8
36
 
37
+ > 9 June 2022
38
+
39
+ - change(footer): updated managed by grid sizes from footer.stories [`#38`](https://github.com/eea/volto-eea-website-theme/pull/38)
9
40
  - change(footer): updated managed by grid sizes from footer.stories #37 [`63b86be`](https://github.com/eea/volto-eea-website-theme/commit/63b86becdf5a501b133e3b4ff05b1ab0e6281f12)
10
41
  - change(footer): updated managed by grid sizes as se [`6be36fa`](https://github.com/eea/volto-eea-website-theme/commit/6be36fa6e8d8a2762fce65b71bb0e0c795a050a2)
11
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "0.6.7",
3
+ "version": "0.6.10",
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",
@@ -1,3 +1,3 @@
1
- body.view-viewview:not(.wf-state-published) {
1
+ .view-viewview:not(.wf-state-published) .content-area {
2
2
  background-image: url('draft.png') !important;
3
3
  }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Document view component.
3
+ * @module components/theme/View/HomePageInverseView
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+
9
+ import { DefaultView } from '@plone/volto/components/';
10
+
11
+ import { BodyClass } from '@plone/volto/helpers';
12
+
13
+ import { hasBlocksData } from '@plone/volto/helpers';
14
+
15
+ /**
16
+ * Component to display the default view.
17
+ * @function HomePageInverseView
18
+ * @param {Object} content Content object.
19
+ * @returns {string} Markup of the component.
20
+ */
21
+ const HomePageInverseView = ({ content }) => {
22
+ return hasBlocksData(content) ? (
23
+ <>
24
+ <BodyClass className="homepage homepage-inverse" />
25
+ <DefaultView content={content} />
26
+ </>
27
+ ) : null;
28
+ };
29
+
30
+ /**
31
+ * Property types.
32
+ * @property {Object} propTypes Property types.
33
+ * @static
34
+ */
35
+ HomePageInverseView.propTypes = {
36
+ /**
37
+ * Content of the object
38
+ */
39
+ content: PropTypes.shape({
40
+ /**
41
+ * Title of the object
42
+ */
43
+ title: PropTypes.string,
44
+ /**
45
+ * Description of the object
46
+ */
47
+ description: PropTypes.string,
48
+ /**
49
+ * Text of the object
50
+ */
51
+ text: PropTypes.shape({
52
+ /**
53
+ * Data of the text of the object
54
+ */
55
+ data: PropTypes.string,
56
+ }),
57
+ }).isRequired,
58
+ };
59
+
60
+ export default HomePageInverseView;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Document view component.
3
+ * @module components/theme/View/HomePageView
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+
9
+ import { DefaultView } from '@plone/volto/components/';
10
+
11
+ import { BodyClass } from '@plone/volto/helpers';
12
+
13
+ import { hasBlocksData } from '@plone/volto/helpers';
14
+
15
+ /**
16
+ * Component to display the default view.
17
+ * @function HomePageView
18
+ * @param {Object} content Content object.
19
+ * @returns {string} Markup of the component.
20
+ */
21
+ const HomePageView = ({ content }) => {
22
+ return hasBlocksData(content) ? (
23
+ <>
24
+ <BodyClass className="homepage" />
25
+ <DefaultView content={content} />
26
+ </>
27
+ ) : null;
28
+ };
29
+
30
+ /**
31
+ * Property types.
32
+ * @property {Object} propTypes Property types.
33
+ * @static
34
+ */
35
+ HomePageView.propTypes = {
36
+ /**
37
+ * Content of the object
38
+ */
39
+ content: PropTypes.shape({
40
+ /**
41
+ * Title of the object
42
+ */
43
+ title: PropTypes.string,
44
+ /**
45
+ * Description of the object
46
+ */
47
+ description: PropTypes.string,
48
+ /**
49
+ * Text of the object
50
+ */
51
+ text: PropTypes.shape({
52
+ /**
53
+ * Data of the text of the object
54
+ */
55
+ data: PropTypes.string,
56
+ }),
57
+ }).isRequired,
58
+ };
59
+
60
+ export default HomePageView;
@@ -0,0 +1,38 @@
1
+ const updatedEEAColorcheme = [
2
+ // Primary & shades
3
+ '#007B6C',
4
+ '#005248',
5
+ '#007B6C',
6
+ '#00A390',
7
+ '#00CCB4',
8
+ '#00F5D8',
9
+ '#85FFF1',
10
+ '#C8FFF8',
11
+ // Secondary & shades
12
+ '#004B7F',
13
+ '#003052',
14
+ '#004B7F',
15
+ '#006BB8',
16
+ '#0083E0',
17
+ '#0A99FF',
18
+ '#47B3FF',
19
+ '#A0D7FF',
20
+ // Tertiary & shades
21
+ '#2E3E4C',
22
+ '#3D5265',
23
+ '#4C677F',
24
+ '#6989A5',
25
+ '#8EA6C2',
26
+ '#ACCAE5',
27
+ '#DAE8F4',
28
+ // Black & White shades
29
+ '#000000',
30
+ '#323232',
31
+ '#67696b',
32
+ '#BCBEC0',
33
+ '#E6E7E8',
34
+ '#F9F9F9',
35
+ '#FFFFFF',
36
+ ];
37
+
38
+ export default updatedEEAColorcheme;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { Container, Input } from 'semantic-ui-react';
3
+ import { withRouter } from 'react-router-dom';
4
+ import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
5
+
6
+ function HeaderSearchPopUp({ history, onClose, triggerRefs = [] }) {
7
+ const nodeRef = React.useRef();
8
+ const [text, setText] = React.useState('');
9
+
10
+ useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
11
+
12
+ const onChangeText = (event, { value }) => {
13
+ setText(value);
14
+ event.preventDefault();
15
+ };
16
+
17
+ const onSubmit = (event) => {
18
+ history.push(`/en/advanced-search?q=${text}`);
19
+
20
+ if (window?.searchContext?.resetSearch) {
21
+ window.searchContext.resetSearch({ searchTerm: text });
22
+ }
23
+
24
+ onClose();
25
+ event.preventDefault();
26
+ };
27
+
28
+ return (
29
+ <form id="search-box" ref={nodeRef} method="get" onSubmit={onSubmit}>
30
+ <Container>
31
+ <div className="wrapper">
32
+ <Input
33
+ className="search"
34
+ onChange={onChangeText}
35
+ icon={{
36
+ className: 'ri-search-line',
37
+ link: true,
38
+ onClick: onSubmit,
39
+ }}
40
+ placeholder="Search..."
41
+ fluid
42
+ />
43
+ </div>
44
+ </Container>
45
+ </form>
46
+ );
47
+ }
48
+
49
+ export default withRouter(HeaderSearchPopUp);
@@ -18,12 +18,14 @@ import { getNavigation } from '@plone/volto/actions';
18
18
  import { Header, Logo } from '@eeacms/volto-eea-design-system/ui';
19
19
  import { usePrevious } from '@eeacms/volto-eea-design-system/helpers';
20
20
  import { find } from 'lodash';
21
+ import WhiteLogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea.svg';
21
22
  import LogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea-logo.svg';
22
23
  import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
23
24
  import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png';
24
25
 
25
26
  import config from '@plone/volto/registry';
26
27
  import { compose } from 'recompose';
28
+ import { BodyClass } from '@plone/volto/helpers';
27
29
 
28
30
  /**
29
31
  * EEA Specific Header component.
@@ -34,6 +36,19 @@ const EEAHeader = ({ pathname, token, items, history }) => {
34
36
  (state) => state.content.data?.['@components']?.translations?.items,
35
37
  );
36
38
 
39
+ const router_pathname = useSelector((state) => {
40
+ return state.router?.location?.pathname || '';
41
+ });
42
+
43
+ const isHomePageInverse = useSelector((state) => {
44
+ const layout = state.content?.data?.layout;
45
+ const has_home_layout = layout === 'homepage_inverse_view';
46
+ return (
47
+ has_home_layout &&
48
+ (pathname === router_pathname || router_pathname.endsWith('/edit'))
49
+ );
50
+ });
51
+
37
52
  const { eea } = config.settings;
38
53
  const width = useSelector((state) => state.screen?.width);
39
54
  const dispatch = useDispatch();
@@ -44,9 +59,9 @@ const EEAHeader = ({ pathname, token, items, history }) => {
44
59
 
45
60
  React.useEffect(() => {
46
61
  const { settings } = config;
47
- const base = getBaseUrl(pathname);
48
- if (!hasApiExpander('navigation', base)) {
49
- dispatch(getNavigation(base, settings.navDepth));
62
+ const base_url = getBaseUrl(pathname);
63
+ if (!hasApiExpander('navigation', base_url)) {
64
+ dispatch(getNavigation(base_url, settings.navDepth));
50
65
  }
51
66
  }, [pathname, dispatch]);
52
67
 
@@ -62,6 +77,7 @@ const EEAHeader = ({ pathname, token, items, history }) => {
62
77
 
63
78
  return (
64
79
  <Header menuItems={items}>
80
+ {isHomePageInverse && <BodyClass className="homepage" />}
65
81
  <Header.TopHeader>
66
82
  <Header.TopItem className="official-union">
67
83
  <Image src={eeaFlag} alt="eea flag"></Image>
@@ -154,9 +170,11 @@ const EEAHeader = ({ pathname, token, items, history }) => {
154
170
  </Header.TopHeader>
155
171
  <Header.Main
156
172
  pathname={pathname}
173
+ inverted={isHomePageInverse ? true : false}
174
+ transparency={isHomePageInverse ? true : false}
157
175
  logo={
158
176
  <Logo
159
- src={LogoImage}
177
+ src={isHomePageInverse ? WhiteLogoImage : LogoImage}
160
178
  title={eea.websiteTitle}
161
179
  alt={eea.organisationName}
162
180
  url={eea.logoTargetUrl}
package/src/index.js CHANGED
@@ -4,13 +4,22 @@ import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manag
4
4
  import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
5
5
  import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
6
6
  import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
7
+ import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
8
+ import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
7
9
 
8
10
  const applyConfig = (config) => {
11
+ // EEA specific settings
9
12
  config.settings.eea = {
10
13
  ...eea,
11
14
  ...(config.settings.eea || {}),
12
15
  };
13
16
 
17
+ // Homepage
18
+ config.views.layoutViews = {
19
+ homepage_view: HomePageView,
20
+ homepage_inverse_view: HomePageInverseView,
21
+ };
22
+
14
23
  // Apply accordion block customization
15
24
  if (config.blocks.blocksConfig.accordion) {
16
25
  config.blocks.blocksConfig.accordion.semanticIcon = 'ri-arrow-down-s-line';
@@ -45,8 +54,8 @@ const applyConfig = (config) => {
45
54
  },
46
55
  ];
47
56
 
57
+ // Custom CSS voltoCustom.css and Draft Background
48
58
  const appExtras = config.settings.appExtras || [];
49
-
50
59
  config.settings.appExtras = [
51
60
  ...appExtras,
52
61
  {
@@ -59,6 +68,64 @@ const applyConfig = (config) => {
59
68
  },
60
69
  ];
61
70
 
71
+ // Custom block styles
72
+ config.settings.pluggableStyles = [
73
+ ...(config.settings.pluggableStyles || []),
74
+ {
75
+ id: 'content-box-gray',
76
+ title: 'Content Box',
77
+ viewComponent: (props) => {
78
+ return (
79
+ <div className="content-box">
80
+ <div className="content-box-inner ui container">
81
+ {props.children}
82
+ </div>
83
+ </div>
84
+ );
85
+ },
86
+ },
87
+ {
88
+ id: 'content-box-primary',
89
+ title: 'Content Box (primary)',
90
+ viewComponent: (props) => {
91
+ return (
92
+ <div className="content-box primary">
93
+ <div className="content-box-inner ui container">
94
+ {props.children}
95
+ </div>
96
+ </div>
97
+ );
98
+ },
99
+ },
100
+ {
101
+ id: 'content-box-secondary',
102
+ title: 'Content Box (secondary)',
103
+ viewComponent: (props) => {
104
+ return (
105
+ <div className="content-box secondary">
106
+ <div className="content-box-inner ui container">
107
+ {props.children}
108
+ </div>
109
+ </div>
110
+ );
111
+ },
112
+ },
113
+ {
114
+ id: 'content-box-tertiary',
115
+ title: 'Content Box (tertiary)',
116
+ viewComponent: (props) => {
117
+ return (
118
+ <div className="content-box tertiary">
119
+ <div className="content-box-inner ui container">
120
+ {props.children}
121
+ </div>
122
+ </div>
123
+ );
124
+ },
125
+ },
126
+ ];
127
+
128
+ // Custom blocks
62
129
  return [installCustomTitle].reduce((acc, apply) => apply(acc), config);
63
130
  };
64
131