@eeacms/volto-n2k 1.0.20 → 1.0.22
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 +7 -2
- package/package.json +2 -4
- package/src/components/index.js +2 -2
- package/src/components/manage/Blocks/CarouselHorizontal/HorizontalView.jsx +84 -37
- package/src/components/manage/Blocks/CarouselHorizontal/styles.less +32 -0
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +21 -11
- package/src/components/manage/Blocks/Landing/index.js +6 -6
- package/src/components/manage/Blocks/Landing/style.less +51 -32
- package/src/components/manage/Blocks/NavigationAnchors/View.jsx +15 -9
- package/src/components/manage/Blocks/SiteBanner/style.less +4 -0
- package/src/components/manage/Blocks/SiteShape/View.jsx +4 -4
- package/src/components/manage/Blocks/SiteSpeciesList/style.less +2 -1
- package/src/components/manage/Blocks/TilesImages/View.jsx +1 -0
- package/src/index.js +1 -48
- package/src/less/styles.less +0 -42
- package/src/components/theme/Footer/Footer.jsx +0 -209
- package/src/components/theme/Header/Header.jsx +0 -169
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -98
- package/src/components/theme/LanguageSelector/styles.less +0 -62
- package/src/components/theme/Navigation/Navigation.jsx +0 -524
- package/src/components/theme/Navigation/bise.svg +0 -132
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-extend-native */
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import loadable from '@loadable/component';
|
|
4
3
|
import { compose } from 'redux';
|
|
5
4
|
import { connectToProviderData } from '@eeacms/volto-datablocks/hocs';
|
|
@@ -44,11 +43,9 @@ import installTilesImages from './components/manage/Blocks/TilesImages';
|
|
|
44
43
|
|
|
45
44
|
import { LINK } from '@plone/volto-slate/constants';
|
|
46
45
|
|
|
47
|
-
import { Header } from '@eeacms/volto-n2k/components';
|
|
48
|
-
|
|
49
46
|
import { gridSizes, variants } from './grid';
|
|
50
47
|
|
|
51
|
-
import './less/styles.less';
|
|
48
|
+
// import './less/styles.less';
|
|
52
49
|
|
|
53
50
|
Array.prototype.sortByProperty = function (property, order = 'ASC') {
|
|
54
51
|
return this.sort((a, b) => {
|
|
@@ -72,50 +69,6 @@ const applyConfig = (config) => {
|
|
|
72
69
|
|
|
73
70
|
config.settings.persistentReducers.push('localStorage');
|
|
74
71
|
|
|
75
|
-
config.settings = {
|
|
76
|
-
...config.settings,
|
|
77
|
-
n2k: {
|
|
78
|
-
multilingualRoot: '/natura2000/:lang',
|
|
79
|
-
multilingualPath: '/natura2000/:lang/*',
|
|
80
|
-
defaultLanguage: 'en',
|
|
81
|
-
supportedLanguages: [
|
|
82
|
-
'bg',
|
|
83
|
-
'hr',
|
|
84
|
-
'cs',
|
|
85
|
-
'da',
|
|
86
|
-
'nl',
|
|
87
|
-
'en',
|
|
88
|
-
'et',
|
|
89
|
-
'fi',
|
|
90
|
-
'fr',
|
|
91
|
-
'de',
|
|
92
|
-
'el',
|
|
93
|
-
'hu',
|
|
94
|
-
'ga',
|
|
95
|
-
'it',
|
|
96
|
-
'lv',
|
|
97
|
-
'lt',
|
|
98
|
-
'mt',
|
|
99
|
-
'pl',
|
|
100
|
-
'pt',
|
|
101
|
-
'ro',
|
|
102
|
-
'sk',
|
|
103
|
-
'sl',
|
|
104
|
-
'es',
|
|
105
|
-
'sv',
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
config.settings.themes = {
|
|
111
|
-
...(config.settings.themes || {}),
|
|
112
|
-
natura2000: {
|
|
113
|
-
Header: Header,
|
|
114
|
-
// Footer: Footer,
|
|
115
|
-
Breadcrumbs: () => <></>,
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
72
|
config.blocks.blocksConfig.columnsBlock = {
|
|
120
73
|
...(config.blocks.blocksConfig.columnsBlock || {}),
|
|
121
74
|
gridSizes: {
|
package/src/less/styles.less
CHANGED
|
@@ -402,16 +402,6 @@ img.slick-image {
|
|
|
402
402
|
pointer-events: none;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
.styled.protected-habitats
|
|
406
|
-
> .tabs-block.default
|
|
407
|
-
> .styled
|
|
408
|
-
> .tabs.default
|
|
409
|
-
> .ui.menu {
|
|
410
|
-
border-bottom: 2px solid #dadada;
|
|
411
|
-
margin-bottom: 1rem;
|
|
412
|
-
border-radius: 0;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
405
|
.sdf-image {
|
|
416
406
|
height: 500px;
|
|
417
407
|
|
|
@@ -480,38 +470,6 @@ img.slick-image {
|
|
|
480
470
|
}
|
|
481
471
|
}
|
|
482
472
|
|
|
483
|
-
.protected-habitats {
|
|
484
|
-
.default.tabs {
|
|
485
|
-
.ui.menu {
|
|
486
|
-
border-bottom: none !important;
|
|
487
|
-
background-color: #00a390;
|
|
488
|
-
|
|
489
|
-
.item {
|
|
490
|
-
padding: 1rem;
|
|
491
|
-
border-radius: 0;
|
|
492
|
-
color: #fff !important;
|
|
493
|
-
|
|
494
|
-
p {
|
|
495
|
-
font-size: 16px !important;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
&.active:hover,
|
|
499
|
-
&:hover {
|
|
500
|
-
padding-bottom: calc(1rem - 3px);
|
|
501
|
-
border-bottom: 3px solid #fff;
|
|
502
|
-
color: #fff !important;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
&.active {
|
|
506
|
-
padding-bottom: calc(1rem - 3px);
|
|
507
|
-
border-bottom: 3px solid #fff;
|
|
508
|
-
color: #fff !important;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
473
|
.smart-table .search-description {
|
|
516
474
|
margin-bottom: 2rem;
|
|
517
475
|
color: #6b6b6b;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-no-target-blank */
|
|
2
|
-
/**
|
|
3
|
-
* Footer component.
|
|
4
|
-
* @module components/theme/Footer/Footer
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { Container, Segment, Grid } from 'semantic-ui-react';
|
|
9
|
-
import { Link } from 'react-router-dom';
|
|
10
|
-
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
11
|
-
import LogoImage from '@plone/volto/components/theme/Logo/Logo.svg';
|
|
12
|
-
|
|
13
|
-
import { LazyLoadImage } from 'react-lazy-load-image-component';
|
|
14
|
-
|
|
15
|
-
import ecLogo from '../../../static/ec.png';
|
|
16
|
-
import eeaLogo from '../../../static/eea.png';
|
|
17
|
-
import fiseLogo from '../../../static/forest.svg';
|
|
18
|
-
import ccaLogo from '../../../static/cca.svg';
|
|
19
|
-
import wiseLogo from '../../../static/wise.png';
|
|
20
|
-
|
|
21
|
-
// const messages = defineMessages({
|
|
22
|
-
// copyright: {
|
|
23
|
-
// id: 'Copyright',
|
|
24
|
-
// defaultMessage: 'Copyright',
|
|
25
|
-
// },
|
|
26
|
-
// });
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Component to display the footer.
|
|
30
|
-
* @function Footer
|
|
31
|
-
* @param {Object} intl Intl object
|
|
32
|
-
* @returns {string} Markup of the component
|
|
33
|
-
*/
|
|
34
|
-
const Footer = ({ intl }) => (
|
|
35
|
-
<Segment role="contentinfo" vertical padded className="footerWrapper">
|
|
36
|
-
<Container>
|
|
37
|
-
<div className="footer-top-wrapper">
|
|
38
|
-
<Grid stackable>
|
|
39
|
-
<Grid.Row>
|
|
40
|
-
<Grid.Column mobile={16} tablet={10} computer={10}>
|
|
41
|
-
<ul className="footer-nav" id="footer_links">
|
|
42
|
-
<li>
|
|
43
|
-
<Link className="item" to="/natura2000">
|
|
44
|
-
<FormattedMessage id="home" defaultMessage="Home" />
|
|
45
|
-
</Link>
|
|
46
|
-
</li>
|
|
47
|
-
<li>
|
|
48
|
-
<a className="item" href={`mailto:bise@eea.europa.eu`}>
|
|
49
|
-
Contact
|
|
50
|
-
</a>
|
|
51
|
-
</li>
|
|
52
|
-
<li>
|
|
53
|
-
<Link className="item" to="/natura2000/sitemap">
|
|
54
|
-
<FormattedMessage id="sitemap" defaultMessage="Sitemap" />
|
|
55
|
-
</Link>
|
|
56
|
-
</li>
|
|
57
|
-
<li>
|
|
58
|
-
<Link
|
|
59
|
-
className="item"
|
|
60
|
-
to="/natura2000/legal-and-privacy-notice"
|
|
61
|
-
>
|
|
62
|
-
<FormattedMessage
|
|
63
|
-
id="legal_notice"
|
|
64
|
-
defaultMessage="Privacy and legal notice"
|
|
65
|
-
/>
|
|
66
|
-
</Link>
|
|
67
|
-
</li>
|
|
68
|
-
<li>
|
|
69
|
-
<Link className="item" to="/natura2000/copyright-notice">
|
|
70
|
-
<FormattedMessage
|
|
71
|
-
id="copyright_notice"
|
|
72
|
-
defaultMessage="Copyright notice"
|
|
73
|
-
/>
|
|
74
|
-
</Link>
|
|
75
|
-
</li>
|
|
76
|
-
</ul>
|
|
77
|
-
</Grid.Column>
|
|
78
|
-
<Grid.Column mobile={16} tablet={2} computer={2}>
|
|
79
|
-
<Link to="/">
|
|
80
|
-
<img
|
|
81
|
-
className="bise-footer"
|
|
82
|
-
src={LogoImage}
|
|
83
|
-
alt="BISE"
|
|
84
|
-
height={50}
|
|
85
|
-
width={150}
|
|
86
|
-
/>
|
|
87
|
-
</Link>
|
|
88
|
-
</Grid.Column>
|
|
89
|
-
</Grid.Row>
|
|
90
|
-
</Grid>
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div className="site-info">
|
|
94
|
-
<Grid stackable>
|
|
95
|
-
<Grid.Row>
|
|
96
|
-
<Grid.Column
|
|
97
|
-
mobile={16}
|
|
98
|
-
tablet={16}
|
|
99
|
-
computer={5}
|
|
100
|
-
className="information"
|
|
101
|
-
>
|
|
102
|
-
<div>
|
|
103
|
-
<p>
|
|
104
|
-
The Biodiversity information system for Europe is a
|
|
105
|
-
partnership between the{' '}
|
|
106
|
-
<a
|
|
107
|
-
href="https://ec.europa.eu/"
|
|
108
|
-
target="_blank"
|
|
109
|
-
rel="noopener"
|
|
110
|
-
>
|
|
111
|
-
European Commission
|
|
112
|
-
</a>{' '}
|
|
113
|
-
and the{' '}
|
|
114
|
-
<a
|
|
115
|
-
href="https://www.eea.europa.eu/"
|
|
116
|
-
target="_blank"
|
|
117
|
-
rel="noopener"
|
|
118
|
-
>
|
|
119
|
-
European Environment Agency.
|
|
120
|
-
</a>
|
|
121
|
-
</p>{' '}
|
|
122
|
-
</div>
|
|
123
|
-
<div className="site-info-logos">
|
|
124
|
-
<a href="https://ec.europa.eu/" aria-label="European Comission">
|
|
125
|
-
<LazyLoadImage
|
|
126
|
-
className="footerLogo"
|
|
127
|
-
src={ecLogo}
|
|
128
|
-
title="European Commission"
|
|
129
|
-
alt="European Commission"
|
|
130
|
-
/>
|
|
131
|
-
</a>
|
|
132
|
-
<a
|
|
133
|
-
href="https://www.eea.europa.eu/"
|
|
134
|
-
aria-label="European Environment Agency"
|
|
135
|
-
>
|
|
136
|
-
<LazyLoadImage
|
|
137
|
-
className="footerLogo"
|
|
138
|
-
src={eeaLogo}
|
|
139
|
-
title="European Environment Agency"
|
|
140
|
-
alt="European Environment Agency"
|
|
141
|
-
/>
|
|
142
|
-
</a>
|
|
143
|
-
</div>
|
|
144
|
-
</Grid.Column>
|
|
145
|
-
|
|
146
|
-
<Grid.Column
|
|
147
|
-
mobile={16}
|
|
148
|
-
tablet={16}
|
|
149
|
-
computer={7}
|
|
150
|
-
className="other-information"
|
|
151
|
-
>
|
|
152
|
-
<div>
|
|
153
|
-
<p>Other European Information Systems</p>
|
|
154
|
-
</div>
|
|
155
|
-
<div className="footerLogos">
|
|
156
|
-
<a
|
|
157
|
-
href="https://water.europa.eu/"
|
|
158
|
-
aria-label="Water Information System for Europe"
|
|
159
|
-
>
|
|
160
|
-
<LazyLoadImage
|
|
161
|
-
className="footerLogo"
|
|
162
|
-
src={wiseLogo}
|
|
163
|
-
title="Water Information System for Europe"
|
|
164
|
-
alt="Water Information System for Europe"
|
|
165
|
-
/>
|
|
166
|
-
</a>
|
|
167
|
-
<a
|
|
168
|
-
href="https://forest.eea.europa.eu/"
|
|
169
|
-
aria-label="Forest Information System for Europe"
|
|
170
|
-
>
|
|
171
|
-
<LazyLoadImage
|
|
172
|
-
className="footerLogo"
|
|
173
|
-
src={fiseLogo}
|
|
174
|
-
title="Forest Information System for Europe"
|
|
175
|
-
alt="Forest Information System for Europe"
|
|
176
|
-
/>
|
|
177
|
-
</a>
|
|
178
|
-
<a
|
|
179
|
-
href="https://climate-adapt.eea.europa.eu/"
|
|
180
|
-
aria-label="Climate-Adapt"
|
|
181
|
-
>
|
|
182
|
-
<LazyLoadImage
|
|
183
|
-
className="footerLogo"
|
|
184
|
-
src={ccaLogo}
|
|
185
|
-
title="Climate-Adapt"
|
|
186
|
-
alt="Climate-Adapt"
|
|
187
|
-
/>
|
|
188
|
-
</a>
|
|
189
|
-
</div>
|
|
190
|
-
</Grid.Column>
|
|
191
|
-
</Grid.Row>
|
|
192
|
-
</Grid>
|
|
193
|
-
</div>
|
|
194
|
-
</Container>
|
|
195
|
-
</Segment>
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Property types.
|
|
200
|
-
* @property {Object} propTypes Property types.
|
|
201
|
-
* @static
|
|
202
|
-
*/
|
|
203
|
-
Footer.propTypes = {
|
|
204
|
-
/**
|
|
205
|
-
* i18n object
|
|
206
|
-
*/
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export default injectIntl(Footer);
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Header component.
|
|
3
|
-
* @module components/theme/Header/Header
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useEffect, useContext, useMemo } from 'react';
|
|
7
|
-
import cx from 'classnames';
|
|
8
|
-
import { matchPath, withRouter } from 'react-router';
|
|
9
|
-
import { Link } from 'react-router-dom';
|
|
10
|
-
import { compose } from 'redux';
|
|
11
|
-
import { connect } from 'react-redux';
|
|
12
|
-
import { Portal } from 'react-portal';
|
|
13
|
-
import { Container, Segment, Sticky, Image } from 'semantic-ui-react';
|
|
14
|
-
import config from '@plone/volto/registry';
|
|
15
|
-
import { Anontools } from '@plone/volto/components';
|
|
16
|
-
import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
17
|
-
import { StickyContext } from '@eeacms/volto-bise/components';
|
|
18
|
-
import Navigation from '../Navigation/Navigation';
|
|
19
|
-
import LanguageSelector from '../LanguageSelector/LanguageSelector';
|
|
20
|
-
|
|
21
|
-
import BISELogo from '@eeacms/volto-bise/customizations/volto/components/theme/Logo/Logo.svg';
|
|
22
|
-
|
|
23
|
-
function removeTrailingSlash(str) {
|
|
24
|
-
return str.replace(/\/+$/, '');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function matchPaths(paths, pathname) {
|
|
28
|
-
if (
|
|
29
|
-
matchPath(pathname, {
|
|
30
|
-
path: paths,
|
|
31
|
-
exact: true,
|
|
32
|
-
strict: false,
|
|
33
|
-
})
|
|
34
|
-
) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Navbar = (props) => {
|
|
41
|
-
const currentLang = props.localStorage.get('N2K_LANGUAGE');
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div>
|
|
45
|
-
<Segment basic role="banner" className={cx('header-wrapper')}>
|
|
46
|
-
<Container>
|
|
47
|
-
<div className="header">
|
|
48
|
-
<div className="logo-nav-wrapper">
|
|
49
|
-
<div className="logo">
|
|
50
|
-
<Link title="Natura 2000" to="/">
|
|
51
|
-
<Image
|
|
52
|
-
src={BISELogo}
|
|
53
|
-
alt="Biodiversity logo"
|
|
54
|
-
title="Biodiversity logo"
|
|
55
|
-
height={64}
|
|
56
|
-
width={192}
|
|
57
|
-
/>
|
|
58
|
-
</Link>
|
|
59
|
-
</div>
|
|
60
|
-
<div className="tools-search-wrapper">
|
|
61
|
-
{currentLang ? (
|
|
62
|
-
<Navigation
|
|
63
|
-
pathname={props.pathname}
|
|
64
|
-
isSticky={props.isSticky}
|
|
65
|
-
isRoot={props.isRoot}
|
|
66
|
-
isExplorer={props.isExplorer}
|
|
67
|
-
/>
|
|
68
|
-
) : (
|
|
69
|
-
''
|
|
70
|
-
)}
|
|
71
|
-
</div>
|
|
72
|
-
{!props.isSdf && !props.isExplorer && (
|
|
73
|
-
<div className="mobile hidden tablet hidden computer hidden language-selector-wrapper">
|
|
74
|
-
<LanguageSelector navigation={props.navigation} />
|
|
75
|
-
</div>
|
|
76
|
-
)}
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
{!props.token && (
|
|
80
|
-
<Portal
|
|
81
|
-
node={__CLIENT__ && document.querySelector('#footer_links')}
|
|
82
|
-
>
|
|
83
|
-
<Anontools />
|
|
84
|
-
</Portal>
|
|
85
|
-
)}
|
|
86
|
-
</Container>
|
|
87
|
-
</Segment>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const Header = (props) => {
|
|
93
|
-
const [isSticky, setIsSticky] = React.useState(false);
|
|
94
|
-
const { stickyRef } = useContext(StickyContext);
|
|
95
|
-
const isRoot = useMemo(
|
|
96
|
-
() =>
|
|
97
|
-
removeTrailingSlash(props.pathname) !== '/natura2000/natura2000' &&
|
|
98
|
-
matchPath(props.pathname, {
|
|
99
|
-
path: config.settings.n2k.multilingualRoot,
|
|
100
|
-
exact: true,
|
|
101
|
-
strict: false,
|
|
102
|
-
}),
|
|
103
|
-
[props.pathname],
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const isSdf = useMemo(() => matchPaths(config.settings.sdf, props.pathname), [
|
|
107
|
-
props.pathname,
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
const isExplorer = useMemo(
|
|
111
|
-
() => matchPaths(config.settings.explorer, props.pathname),
|
|
112
|
-
[props.pathname],
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
if (!props.localStorage.get('N2K_LANGUAGE')) {
|
|
117
|
-
props.localStorage.set(
|
|
118
|
-
'N2K_LANGUAGE',
|
|
119
|
-
config.settings.n2k.defaultLanguage,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
/* eslint-disable-next-line */
|
|
123
|
-
}, []);
|
|
124
|
-
|
|
125
|
-
return isRoot ? (
|
|
126
|
-
<div className="ui basic segment sticky-header-wrapper">
|
|
127
|
-
<div className="ui sticky">
|
|
128
|
-
<Navbar
|
|
129
|
-
{...props}
|
|
130
|
-
isSticky={false}
|
|
131
|
-
isRoot={isRoot}
|
|
132
|
-
isSdf={isSdf}
|
|
133
|
-
isExplorer={isExplorer}
|
|
134
|
-
/>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
) : (
|
|
138
|
-
<Sticky
|
|
139
|
-
context={stickyRef}
|
|
140
|
-
className="ui basic segment sticky-header-wrapper"
|
|
141
|
-
role="banner"
|
|
142
|
-
onStick={() => {
|
|
143
|
-
setIsSticky(true);
|
|
144
|
-
}}
|
|
145
|
-
onUnstick={() => {
|
|
146
|
-
setIsSticky(false);
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
<Navbar
|
|
150
|
-
{...props}
|
|
151
|
-
isSticky={isSticky}
|
|
152
|
-
isRoot={isRoot}
|
|
153
|
-
isSdf={isSdf}
|
|
154
|
-
isExplorer={isExplorer}
|
|
155
|
-
/>
|
|
156
|
-
</Sticky>
|
|
157
|
-
);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export default compose(
|
|
161
|
-
withRouter,
|
|
162
|
-
withLocalStorage,
|
|
163
|
-
connect((state) => {
|
|
164
|
-
return {
|
|
165
|
-
token: state.userSession.token,
|
|
166
|
-
navigation: state.navigation,
|
|
167
|
-
};
|
|
168
|
-
}),
|
|
169
|
-
)(Header);
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Language selector component.
|
|
3
|
-
* @module components/LanguageSelector/LanguageSelector
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { withRouter, matchPath, generatePath } from 'react-router';
|
|
8
|
-
import { useSelector } from 'react-redux';
|
|
9
|
-
import cx from 'classnames';
|
|
10
|
-
import { langmap } from '@plone/volto/helpers';
|
|
11
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
12
|
-
import { Dropdown, Image } from 'semantic-ui-react';
|
|
13
|
-
import config from '@plone/volto/registry';
|
|
14
|
-
import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
15
|
-
import { getN2kItems, pathExists } from '@eeacms/volto-n2k/helpers';
|
|
16
|
-
import './styles.less';
|
|
17
|
-
|
|
18
|
-
import globeIcon from '@eeacms/volto-n2k/static/global-line.svg';
|
|
19
|
-
|
|
20
|
-
const LanguageSelector = (props) => {
|
|
21
|
-
const { settings } = config;
|
|
22
|
-
const content = useSelector((state) => state.content);
|
|
23
|
-
const n2kItems = getN2kItems(props.navigation.items);
|
|
24
|
-
const localStorage = props.localStorage;
|
|
25
|
-
const pathname = props.location.pathname;
|
|
26
|
-
const currentLang = localStorage.get('N2K_LANGUAGE');
|
|
27
|
-
const matchRoot = matchPath(pathname, {
|
|
28
|
-
path: settings.n2k.multilingualRoot,
|
|
29
|
-
exact: true,
|
|
30
|
-
strict: false,
|
|
31
|
-
});
|
|
32
|
-
const matchChild = matchPath(pathname, {
|
|
33
|
-
path: settings.n2k.multilingualPath,
|
|
34
|
-
exact: true,
|
|
35
|
-
strict: false,
|
|
36
|
-
});
|
|
37
|
-
const match = matchRoot || matchChild;
|
|
38
|
-
const hasMultilingualSupport =
|
|
39
|
-
match && settings.n2k.supportedLanguages.includes(match.params.lang);
|
|
40
|
-
const translations = hasMultilingualSupport
|
|
41
|
-
? settings.n2k.supportedLanguages.map((lang) => {
|
|
42
|
-
return {
|
|
43
|
-
path: matchRoot
|
|
44
|
-
? `/natura2000/${lang}`
|
|
45
|
-
: generatePath(settings.n2k.multilingualPath, {
|
|
46
|
-
...match.params,
|
|
47
|
-
lang,
|
|
48
|
-
}),
|
|
49
|
-
lang,
|
|
50
|
-
};
|
|
51
|
-
})
|
|
52
|
-
: [];
|
|
53
|
-
const supportedLanguagesOptions = settings.n2k.supportedLanguages.map(
|
|
54
|
-
(lang) => ({
|
|
55
|
-
key: lang,
|
|
56
|
-
value: lang,
|
|
57
|
-
text: langmap[lang].nativeName,
|
|
58
|
-
}),
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className={cx('language-selector', props.className)}>
|
|
63
|
-
<Dropdown
|
|
64
|
-
aria-label="Language selector"
|
|
65
|
-
disabled={content.get.loading}
|
|
66
|
-
placeholder="Select a language"
|
|
67
|
-
text={currentLang}
|
|
68
|
-
scrolling
|
|
69
|
-
icon={
|
|
70
|
-
<Image src={globeIcon} alt="language dropdown globe icon"></Image>
|
|
71
|
-
}
|
|
72
|
-
options={supportedLanguagesOptions}
|
|
73
|
-
value={currentLang}
|
|
74
|
-
onChange={(_, data) => {
|
|
75
|
-
const lang = data.value;
|
|
76
|
-
const translation = translations.filter(
|
|
77
|
-
(item) => item.lang === lang,
|
|
78
|
-
)[0];
|
|
79
|
-
|
|
80
|
-
if (translation && translation.path) {
|
|
81
|
-
const exists = pathExists(translation.path, n2kItems);
|
|
82
|
-
if (exists) {
|
|
83
|
-
props.history.push(flattenToAppURL(translation.path));
|
|
84
|
-
} else {
|
|
85
|
-
props.history.push('/natura2000');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (config.settings.n2k.supportedLanguages.includes(lang)) {
|
|
90
|
-
localStorage.set('N2K_LANGUAGE', lang);
|
|
91
|
-
}
|
|
92
|
-
}}
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default withRouter(withLocalStorage(LanguageSelector));
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
.computer.hidden.language-selector-wrapper {
|
|
2
|
-
.language-selector > .ui.dropdown {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-flow: row-reverse;
|
|
5
|
-
align-items: center;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.language-selector {
|
|
10
|
-
margin-right: 0;
|
|
11
|
-
|
|
12
|
-
.ui.dropdown {
|
|
13
|
-
.divider.text {
|
|
14
|
-
display: inline-block;
|
|
15
|
-
color: #005248 !important;
|
|
16
|
-
font-family: OpenSans, 'Raleway', sans-serif;
|
|
17
|
-
font-weight: 700;
|
|
18
|
-
text-transform: uppercase;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.ui.image {
|
|
22
|
-
display: inline-block;
|
|
23
|
-
margin-right: 0.25rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:hover {
|
|
27
|
-
.divider.text {
|
|
28
|
-
color: #00a390 !important;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
> .menu {
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 30px !important;
|
|
35
|
-
|
|
36
|
-
.item {
|
|
37
|
-
background: #fff !important;
|
|
38
|
-
|
|
39
|
-
.text {
|
|
40
|
-
color: #005248;
|
|
41
|
-
font-family: OpenSans, 'Raleway', sans-serif;
|
|
42
|
-
font-size: 1rem;
|
|
43
|
-
font-weight: 700;
|
|
44
|
-
text-transform: uppercase;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:hover {
|
|
48
|
-
.text {
|
|
49
|
-
color: #00a390;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&.landingpage-variation {
|
|
57
|
-
.divider.text {
|
|
58
|
-
color: #fff !important;
|
|
59
|
-
font-size: 20px;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|