@eeacms/volto-eea-website-theme 1.1.0 → 1.2.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.
- package/.project.eslintrc.js +3 -1
- package/CHANGELOG.md +28 -0
- package/package.json +4 -4
- package/src/components/theme/SubsiteClass.jsx +23 -0
- package/src/config.js +44 -38
- package/src/customizations/volto/components/theme/Header/Header.jsx +91 -70
- package/src/index.js +5 -0
- package/theme/addons/volto-addons/columnsBlocks/columns.variables +7 -0
- package/theme/site/Readme.md +2 -0
- package/theme/theme.config +1 -1
package/.project.eslintrc.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
const fs = require('fs');
|
2
2
|
const path = require('path');
|
3
3
|
|
4
|
-
const projectRootPath = fs.
|
4
|
+
const projectRootPath = fs.existsSync('./project')
|
5
|
+
? fs.realpathSync('./project')
|
6
|
+
: fs.realpathSync('./../../../');
|
5
7
|
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
6
8
|
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
|
7
9
|
|
package/CHANGELOG.md
CHANGED
@@ -4,6 +4,34 @@ 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.2.0](https://github.com/eea/volto-eea-website-theme/compare/1.1.0...1.2.0) - 16 November 2022
|
8
|
+
|
9
|
+
#### :rocket: New Features
|
10
|
+
|
11
|
+
- feat(dependencies): volto-subsites [Alin Voinea - [`7e196b3`](https://github.com/eea/volto-eea-website-theme/commit/7e196b3ba0ffdae32d15fc1a9a020a7f760461ac)]
|
12
|
+
- feat(header): customization of logo + check if multilingual [Miu Razvan - [`cc5bb39`](https://github.com/eea/volto-eea-website-theme/commit/cc5bb3927b79b87f269c8a2a77b1913785892658)]
|
13
|
+
|
14
|
+
#### :bug: Bug Fixes
|
15
|
+
|
16
|
+
- fix(eslint): remove .project.eslintrc.js [Miu Razvan - [`5cf763f`](https://github.com/eea/volto-eea-website-theme/commit/5cf763f4451dab6b63705b8346912145e6b8cc73)]
|
17
|
+
|
18
|
+
#### :nail_care: Enhancements
|
19
|
+
|
20
|
+
- change(theme): modified volto-columns-block padding and margin values [David Ichim - [`830b571`](https://github.com/eea/volto-eea-website-theme/commit/830b5711c89c3bcceda01a5cf9372ae4118dfa9d)]
|
21
|
+
- change(theme): modified path for site theme [David Ichim - [`3996f88`](https://github.com/eea/volto-eea-website-theme/commit/3996f8836741242fd75517a5a5a9c5180be75aad)]
|
22
|
+
- change(website-theme): removed dependency on slate now that plone has slate builtin [David Ichim - [`5840c03`](https://github.com/eea/volto-eea-website-theme/commit/5840c03a8f2c89e44014c93b2b2198467d111b84)]
|
23
|
+
|
24
|
+
#### :hammer_and_wrench: Others
|
25
|
+
|
26
|
+
- Release 1.2.0 [Alin Voinea - [`567f1b1`](https://github.com/eea/volto-eea-website-theme/commit/567f1b12d6915f960b73016de3ac53e00a47e9f7)]
|
27
|
+
- Add volto-subsite dependency [kreafox - [`7f2751f`](https://github.com/eea/volto-eea-website-theme/commit/7f2751f3da169138971e3c06b932bbe6fb909abf)]
|
28
|
+
- Remove console.log [kreafox - [`098f028`](https://github.com/eea/volto-eea-website-theme/commit/098f0282f8694e164b1724c214706c566943e340)]
|
29
|
+
- Fix undefined error [kreafox - [`461d693`](https://github.com/eea/volto-eea-website-theme/commit/461d6938630d0c110e9c9f369846bfaac314ea2c)]
|
30
|
+
- Improve subsite [kreafox - [`108b03a`](https://github.com/eea/volto-eea-website-theme/commit/108b03a8d31bf642509f0ab9c624aa0309b5faec)]
|
31
|
+
- Add .project.eslintrc.js [Alin Voinea - [`b7be5f5`](https://github.com/eea/volto-eea-website-theme/commit/b7be5f5628f555100293e06e9fd7a25b8b7ec16b)]
|
32
|
+
- Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
|
33
|
+
- Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
|
34
|
+
- fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
|
7
35
|
### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
|
8
36
|
|
9
37
|
#### :nail_care: Enhancements
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eeacms/volto-eea-website-theme",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.2.0",
|
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",
|
@@ -14,7 +14,8 @@
|
|
14
14
|
"react"
|
15
15
|
],
|
16
16
|
"addons": [
|
17
|
-
"@eeacms/volto-eea-design-system"
|
17
|
+
"@eeacms/volto-eea-design-system",
|
18
|
+
"volto-subsites"
|
18
19
|
],
|
19
20
|
"repository": {
|
20
21
|
"type": "git",
|
@@ -22,8 +23,7 @@
|
|
22
23
|
},
|
23
24
|
"dependencies": {
|
24
25
|
"@eeacms/volto-eea-design-system": "*",
|
25
|
-
"
|
26
|
-
"slate-react": "^0.71.0"
|
26
|
+
"volto-subsites": "*"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"@plone/scripts": "*",
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import cx from 'classnames';
|
3
|
+
import { useSelector } from 'react-redux';
|
4
|
+
import { useLocation } from 'react-router-dom';
|
5
|
+
|
6
|
+
import { BodyClass } from '@plone/volto/helpers';
|
7
|
+
import { isSubsiteRoot } from 'volto-subsites/utils';
|
8
|
+
|
9
|
+
const SubsiteClass = () => {
|
10
|
+
const subsite = useSelector(
|
11
|
+
(state) => state.content?.data?.['@components']?.subsite || {},
|
12
|
+
);
|
13
|
+
const location = useLocation();
|
14
|
+
|
15
|
+
return (
|
16
|
+
<BodyClass
|
17
|
+
className={cx('subsite', `subsite-${subsite.subsite_css_class?.token}`, {
|
18
|
+
'subsite-root': isSubsiteRoot(location.pathname, subsite),
|
19
|
+
})}
|
20
|
+
/>
|
21
|
+
);
|
22
|
+
};
|
23
|
+
export default SubsiteClass;
|
package/src/config.js
CHANGED
@@ -8,7 +8,8 @@ import copernicusLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/
|
|
8
8
|
import industryLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/industry.svg';
|
9
9
|
import marineLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/marine.svg';
|
10
10
|
import eionetLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eionet.svg';
|
11
|
-
import eeaLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/
|
11
|
+
import eeaLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea-logo.svg';
|
12
|
+
import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea-white.svg';
|
12
13
|
import climateLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/climate-health.svg';
|
13
14
|
|
14
15
|
// TODO: to be consolidated with headerLinks
|
@@ -92,7 +93,7 @@ export const footerOpts = {
|
|
92
93
|
managedBy: [
|
93
94
|
{
|
94
95
|
link: 'https://www.eea.europa.eu/',
|
95
|
-
src:
|
96
|
+
src: eeaWhiteLogo,
|
96
97
|
alt: 'EEA Logo',
|
97
98
|
className: 'site logo',
|
98
99
|
columnSize: {
|
@@ -175,42 +176,47 @@ export const footerOpts = {
|
|
175
176
|
address: 'Kongens Nytorv 6 1050 Copenhagen K (+45) 33 36 71 00',
|
176
177
|
};
|
177
178
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
179
|
+
// Header.jsx config options
|
180
|
+
export const headerOpts = {
|
181
|
+
logo: eeaLogo,
|
182
|
+
logoWhite: eeaWhiteLogo,
|
183
|
+
partnerLinks: {
|
184
|
+
title: 'Environmental information systems',
|
185
|
+
links: [
|
186
|
+
{
|
187
|
+
title: 'Biodiversity Information System for Europe',
|
188
|
+
href: 'https://biodiversity.europa.eu/',
|
189
|
+
},
|
190
|
+
{
|
191
|
+
title: 'Climate Adaptation Platform',
|
192
|
+
href: 'https://climate-adapt.eea.europa.eu/',
|
193
|
+
},
|
194
|
+
{
|
195
|
+
title: 'Copernicus in situ component',
|
196
|
+
href: 'https://insitu.copernicus.eu/',
|
197
|
+
},
|
198
|
+
{
|
199
|
+
title: 'European Industrial Emissions Portal',
|
200
|
+
href: 'https://industry.eea.europa.eu/',
|
201
|
+
},
|
202
|
+
{
|
203
|
+
title: 'Forest Information System for Europe',
|
204
|
+
href: 'https://forest.eea.europa.eu/',
|
205
|
+
},
|
206
|
+
{
|
207
|
+
title: 'Information Platform for Chemical Monitoring',
|
208
|
+
href: 'https://ipchem.jrc.ec.europa.eu/RDSIdiscovery/ipchem/index.html',
|
209
|
+
},
|
210
|
+
{
|
211
|
+
title: 'Marine Water Information System for Europe',
|
212
|
+
href: 'https://water.europa.eu/marine',
|
213
|
+
},
|
214
|
+
{
|
215
|
+
title: 'Fresh Water Information System for Europe',
|
216
|
+
href: 'https://water.europa.eu/freshwater',
|
217
|
+
},
|
218
|
+
],
|
219
|
+
},
|
214
220
|
};
|
215
221
|
|
216
222
|
export const languages = [
|
@@ -18,8 +18,6 @@ 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-white.svg';
|
22
|
-
import LogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea-logo.svg';
|
23
21
|
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
24
22
|
import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png';
|
25
23
|
|
@@ -29,22 +27,30 @@ import { BodyClass } from '@plone/volto/helpers';
|
|
29
27
|
|
30
28
|
import cx from 'classnames';
|
31
29
|
|
30
|
+
function removeTrailingSlash(path) {
|
31
|
+
return path.replace(/\/+$/, '');
|
32
|
+
}
|
33
|
+
|
32
34
|
/**
|
33
35
|
* EEA Specific Header component.
|
34
36
|
*/
|
35
|
-
const EEAHeader = ({ pathname, token, items, history }) => {
|
37
|
+
const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
36
38
|
const currentLang = useSelector((state) => state.intl.locale);
|
37
39
|
const translations = useSelector(
|
38
40
|
(state) => state.content.data?.['@components']?.translations?.items,
|
39
41
|
);
|
40
42
|
|
41
43
|
const router_pathname = useSelector((state) => {
|
42
|
-
return state.router?.location?.pathname || '';
|
44
|
+
return removeTrailingSlash(state.router?.location?.pathname) || '';
|
43
45
|
});
|
44
46
|
|
47
|
+
const isSubsite = subsite?.['@type'] === 'Subsite';
|
48
|
+
|
45
49
|
const isHomePageInverse = useSelector((state) => {
|
46
50
|
const layout = state.content?.data?.layout;
|
47
|
-
const has_home_layout =
|
51
|
+
const has_home_layout =
|
52
|
+
layout === 'homepage_inverse_view' ||
|
53
|
+
(__CLIENT__ && document.body.classList.contains('homepage-inverse'));
|
48
54
|
return (
|
49
55
|
has_home_layout &&
|
50
56
|
(pathname === router_pathname || router_pathname.endsWith('/edit'))
|
@@ -52,6 +58,8 @@ const EEAHeader = ({ pathname, token, items, history }) => {
|
|
52
58
|
});
|
53
59
|
|
54
60
|
const { eea } = config.settings;
|
61
|
+
const headerOpts = eea.headerOpts || {};
|
62
|
+
const { logo, logoWhite } = headerOpts || {};
|
55
63
|
const width = useSelector((state) => state.screen?.width);
|
56
64
|
const dispatch = useDispatch();
|
57
65
|
const previousToken = usePrevious(token);
|
@@ -116,82 +124,94 @@ const EEAHeader = ({ pathname, token, items, history }) => {
|
|
116
124
|
</Header.TopDropdownMenu>
|
117
125
|
</Header.TopItem>
|
118
126
|
|
119
|
-
|
127
|
+
{!!headerOpts.partnerLinks && (
|
128
|
+
<Header.TopItem>
|
129
|
+
<Header.TopDropdownMenu
|
130
|
+
id="theme-sites"
|
131
|
+
text={headerOpts.partnerLinks.title}
|
132
|
+
viewportWidth={width}
|
133
|
+
>
|
134
|
+
<div className="wrapper">
|
135
|
+
{headerOpts.partnerLinks.links.map((item, index) => (
|
136
|
+
<Dropdown.Item key={index}>
|
137
|
+
<a
|
138
|
+
href={item.href}
|
139
|
+
className="site"
|
140
|
+
target="_blank"
|
141
|
+
rel="noreferrer"
|
142
|
+
>
|
143
|
+
{item.title}
|
144
|
+
</a>
|
145
|
+
</Dropdown.Item>
|
146
|
+
))}
|
147
|
+
</div>
|
148
|
+
</Header.TopDropdownMenu>
|
149
|
+
</Header.TopItem>
|
150
|
+
)}
|
151
|
+
|
152
|
+
{config.settings.isMultilingual && (
|
120
153
|
<Header.TopDropdownMenu
|
121
|
-
id="
|
122
|
-
|
154
|
+
id="language-switcher"
|
155
|
+
className="item"
|
156
|
+
text={`${language.toUpperCase()}`}
|
157
|
+
mobileText={`${language.toUpperCase()}`}
|
158
|
+
icon={
|
159
|
+
<Image src={globeIcon} alt="language dropdown globe icon"></Image>
|
160
|
+
}
|
123
161
|
viewportWidth={width}
|
124
162
|
>
|
125
|
-
<
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
163
|
+
<ul
|
164
|
+
className="wrapper language-list"
|
165
|
+
role="listbox"
|
166
|
+
aria-label="language switcher"
|
167
|
+
>
|
168
|
+
{eea.languages.map((item, index) => (
|
169
|
+
<Dropdown.Item
|
170
|
+
as="li"
|
171
|
+
key={index}
|
172
|
+
text={
|
173
|
+
<span>
|
174
|
+
{item.name}
|
175
|
+
<span className="country-code">
|
176
|
+
{item.code.toUpperCase()}
|
177
|
+
</span>
|
178
|
+
</span>
|
179
|
+
}
|
180
|
+
onClick={() => {
|
181
|
+
const translation = find(translations, {
|
182
|
+
language: item.code,
|
183
|
+
});
|
184
|
+
const to = translation
|
185
|
+
? flattenToAppURL(translation['@id'])
|
186
|
+
: `/${item.code}`;
|
187
|
+
setLanguage(item.code);
|
188
|
+
history.push(to);
|
189
|
+
}}
|
190
|
+
></Dropdown.Item>
|
137
191
|
))}
|
138
|
-
</
|
192
|
+
</ul>
|
139
193
|
</Header.TopDropdownMenu>
|
140
|
-
|
141
|
-
|
142
|
-
<Header.TopDropdownMenu
|
143
|
-
id="language-switcher"
|
144
|
-
className="item"
|
145
|
-
text={`${language.toUpperCase()}`}
|
146
|
-
mobileText={`${language.toUpperCase()}`}
|
147
|
-
icon={
|
148
|
-
<Image src={globeIcon} alt="language dropdown globe icon"></Image>
|
149
|
-
}
|
150
|
-
viewportWidth={width}
|
151
|
-
>
|
152
|
-
<ul
|
153
|
-
className="wrapper language-list"
|
154
|
-
role="listbox"
|
155
|
-
aria-label="language switcher"
|
156
|
-
>
|
157
|
-
{eea.languages.map((item, index) => (
|
158
|
-
<Dropdown.Item
|
159
|
-
as="li"
|
160
|
-
key={index}
|
161
|
-
text={
|
162
|
-
<span>
|
163
|
-
{item.name}
|
164
|
-
<span className="country-code">
|
165
|
-
{item.code.toUpperCase()}
|
166
|
-
</span>
|
167
|
-
</span>
|
168
|
-
}
|
169
|
-
onClick={() => {
|
170
|
-
const translation = find(translations, {
|
171
|
-
language: item.code,
|
172
|
-
});
|
173
|
-
const to = translation
|
174
|
-
? flattenToAppURL(translation['@id'])
|
175
|
-
: `/${item.code}`;
|
176
|
-
setLanguage(item.code);
|
177
|
-
history.push(to);
|
178
|
-
}}
|
179
|
-
></Dropdown.Item>
|
180
|
-
))}
|
181
|
-
</ul>
|
182
|
-
</Header.TopDropdownMenu>
|
194
|
+
)}
|
183
195
|
</Header.TopHeader>
|
184
196
|
<Header.Main
|
185
197
|
pathname={pathname}
|
186
198
|
inverted={isHomePageInverse ? true : false}
|
187
199
|
transparency={isHomePageInverse ? true : false}
|
188
200
|
logo={
|
189
|
-
<
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
201
|
+
<div {...(isSubsite ? { className: 'logo-wrapper' } : {})}>
|
202
|
+
<Logo
|
203
|
+
src={isHomePageInverse ? logoWhite : logo}
|
204
|
+
title={eea.websiteTitle}
|
205
|
+
alt={eea.organisationName}
|
206
|
+
url={eea.logoTargetUrl}
|
207
|
+
/>
|
208
|
+
|
209
|
+
{!!subsite && subsite.title && (
|
210
|
+
<UniversalLink item={subsite} className="subsite-logo">
|
211
|
+
{subsite.title}
|
212
|
+
</UniversalLink>
|
213
|
+
)}
|
214
|
+
</div>
|
195
215
|
}
|
196
216
|
menuItems={items}
|
197
217
|
renderGlobalMenuItem={(item, { onClick }) => (
|
@@ -231,6 +251,7 @@ export default compose(
|
|
231
251
|
(state) => ({
|
232
252
|
token: state.userSession.token,
|
233
253
|
items: state.navigation.items,
|
254
|
+
subsite: state.content.data?.['@components']?.subsite,
|
234
255
|
}),
|
235
256
|
{ getNavigation },
|
236
257
|
),
|
package/src/index.js
CHANGED
@@ -4,6 +4,7 @@ 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 SubsiteClass from './components/theme/SubsiteClass';
|
7
8
|
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
|
8
9
|
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
|
9
10
|
import { Icon } from '@plone/volto/components';
|
@@ -81,6 +82,10 @@ const applyConfig = (config) => {
|
|
81
82
|
match: '',
|
82
83
|
component: DraftBackground,
|
83
84
|
},
|
85
|
+
{
|
86
|
+
match: '',
|
87
|
+
component: SubsiteClass,
|
88
|
+
},
|
84
89
|
];
|
85
90
|
|
86
91
|
if (config.settings.slate) {
|
package/theme/theme.config
CHANGED
@@ -119,7 +119,7 @@
|
|
119
119
|
@themesFolder: '~volto-themes';
|
120
120
|
|
121
121
|
/* Path to site override folder */
|
122
|
-
@siteFolder: '~@eeacms/volto-eea-website-theme/../theme';
|
122
|
+
@siteFolder: '~@eeacms/volto-eea-website-theme/../theme/site';
|
123
123
|
|
124
124
|
/*******************************
|
125
125
|
Import Theme
|