@eeacms/volto-n2k 0.1.1
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/.coverage.babel.config.js +9 -0
- package/.release-it.json +17 -0
- package/CHANGELOG.md +155 -0
- package/DEVELOP.md +53 -0
- package/Jenkinsfile +209 -0
- package/LICENSE.md +9 -0
- package/README.md +62 -0
- package/bootstrap +41 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/integration/block-basics.js +32 -0
- package/cypress/plugins/index.js +26 -0
- package/cypress/support/commands.js +315 -0
- package/cypress/support/index.js +53 -0
- package/cypress.json +12 -0
- package/jest-addon.config.js +36 -0
- package/package.json +57 -0
- package/src/actions.js +20 -0
- package/src/components/index.js +3 -0
- package/src/components/manage/Blocks/BodyClass/Edit.jsx +29 -0
- package/src/components/manage/Blocks/BodyClass/View.jsx +13 -0
- package/src/components/manage/Blocks/BodyClass/index.js +24 -0
- package/src/components/manage/Blocks/BodyClass/schema.js +19 -0
- package/src/components/manage/Blocks/BubbleChart/BubbleChart.jsx +101 -0
- package/src/components/manage/Blocks/BubbleChart/Chart.jsx +67 -0
- package/src/components/manage/Blocks/BubbleChart/ChartContext.jsx +3 -0
- package/src/components/manage/Blocks/BubbleChart/View.jsx +63 -0
- package/src/components/manage/Blocks/BubbleChart/index.js +17 -0
- package/src/components/manage/Blocks/BubbleChart/schema.js +124 -0
- package/src/components/manage/Blocks/BubbleChart/style.less +12 -0
- package/src/components/manage/Blocks/CarouselHorizontal/HorizontalView.jsx +221 -0
- package/src/components/manage/Blocks/CarouselHorizontal/index.js +19 -0
- package/src/components/manage/Blocks/CarouselHorizontal/schema.js +32 -0
- package/src/components/manage/Blocks/CddaShape/View.jsx +109 -0
- package/src/components/manage/Blocks/CddaShape/index.js +23 -0
- package/src/components/manage/Blocks/CddaShape/schema.js +19 -0
- package/src/components/manage/Blocks/CddaShape/style.less +14 -0
- package/src/components/manage/Blocks/ContactBlock/View.jsx +56 -0
- package/src/components/manage/Blocks/ContactBlock/icons/domain.svg +1 -0
- package/src/components/manage/Blocks/ContactBlock/icons/email.svg +1 -0
- package/src/components/manage/Blocks/ContactBlock/icons/location.svg +1 -0
- package/src/components/manage/Blocks/ContactBlock/index.js +17 -0
- package/src/components/manage/Blocks/ContactBlock/schema.js +57 -0
- package/src/components/manage/Blocks/ContactBlock/styles.less +31 -0
- package/src/components/manage/Blocks/ExplodedPiesChart/Pie.jsx +125 -0
- package/src/components/manage/Blocks/ExplodedPiesChart/View.jsx +80 -0
- package/src/components/manage/Blocks/ExplodedPiesChart/index.js +17 -0
- package/src/components/manage/Blocks/ExplodedPiesChart/schema.js +75 -0
- package/src/components/manage/Blocks/ExplodedPiesChart/style.less +80 -0
- package/src/components/manage/Blocks/ExploreHabitats/Edit.jsx +29 -0
- package/src/components/manage/Blocks/ExploreHabitats/View.jsx +177 -0
- package/src/components/manage/Blocks/ExploreHabitats/index.js +24 -0
- package/src/components/manage/Blocks/ExploreHabitats/schema.js +15 -0
- package/src/components/manage/Blocks/ExploreHabitats/style.less +15 -0
- package/src/components/manage/Blocks/ExploreSites/Edit.jsx +29 -0
- package/src/components/manage/Blocks/ExploreSites/View.jsx +175 -0
- package/src/components/manage/Blocks/ExploreSites/index.js +24 -0
- package/src/components/manage/Blocks/ExploreSites/schema.js +15 -0
- package/src/components/manage/Blocks/ExploreSites/style.less +15 -0
- package/src/components/manage/Blocks/ExploreSpecies/Edit.jsx +29 -0
- package/src/components/manage/Blocks/ExploreSpecies/View.jsx +177 -0
- package/src/components/manage/Blocks/ExploreSpecies/index.js +24 -0
- package/src/components/manage/Blocks/ExploreSpecies/schema.js +15 -0
- package/src/components/manage/Blocks/ExploreSpecies/style.less +15 -0
- package/src/components/manage/Blocks/HabitatClassification/View.jsx +30 -0
- package/src/components/manage/Blocks/HabitatClassification/index.js +17 -0
- package/src/components/manage/Blocks/HabitatClassification/schema.js +19 -0
- package/src/components/manage/Blocks/HabitatClassification/style.less +3 -0
- package/src/components/manage/Blocks/HabitatDistribution/View.jsx +97 -0
- package/src/components/manage/Blocks/HabitatDistribution/index.js +23 -0
- package/src/components/manage/Blocks/HabitatDistribution/schema.js +19 -0
- package/src/components/manage/Blocks/HabitatDistribution/style.less +5 -0
- package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +97 -0
- package/src/components/manage/Blocks/HabitatProtectedSites/index.js +23 -0
- package/src/components/manage/Blocks/HabitatProtectedSites/schema.js +19 -0
- package/src/components/manage/Blocks/HabitatProtectedSites/style.less +5 -0
- package/src/components/manage/Blocks/HabitatsBanner/View.jsx +39 -0
- package/src/components/manage/Blocks/HabitatsBanner/index.js +17 -0
- package/src/components/manage/Blocks/HabitatsBanner/schema.js +19 -0
- package/src/components/manage/Blocks/HabitatsBanner/style.less +49 -0
- package/src/components/manage/Blocks/ImageText/Edit.jsx +98 -0
- package/src/components/manage/Blocks/ImageText/View.jsx +66 -0
- package/src/components/manage/Blocks/ImageText/index.js +24 -0
- package/src/components/manage/Blocks/ImageText/schema.js +69 -0
- package/src/components/manage/Blocks/ImageText/styles.less +87 -0
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +83 -0
- package/src/components/manage/Blocks/Landing/Edit.jsx +219 -0
- package/src/components/manage/Blocks/Landing/EditBlockWrapper.jsx +161 -0
- package/src/components/manage/Blocks/Landing/View.jsx +65 -0
- package/src/components/manage/Blocks/Landing/images/background.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/coasts_and_seas.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/forests.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/grasslands.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/hiker.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/islands.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/mountains.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/natura2000.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/natura2000_square.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/peatlands.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/people_and_nature.webp +0 -0
- package/src/components/manage/Blocks/Landing/images/rivers.webp +0 -0
- package/src/components/manage/Blocks/Landing/index.js +104 -0
- package/src/components/manage/Blocks/Landing/schema.js +62 -0
- package/src/components/manage/Blocks/Landing/style.less +174 -0
- package/src/components/manage/Blocks/List/View.jsx +37 -0
- package/src/components/manage/Blocks/List/index.js +17 -0
- package/src/components/manage/Blocks/List/schema.js +49 -0
- package/src/components/manage/Blocks/List/style.less +12 -0
- package/src/components/manage/Blocks/NavigationAnchors/Edit.jsx +33 -0
- package/src/components/manage/Blocks/NavigationAnchors/View.jsx +132 -0
- package/src/components/manage/Blocks/NavigationAnchors/assets/external.png +0 -0
- package/src/components/manage/Blocks/NavigationAnchors/index.js +23 -0
- package/src/components/manage/Blocks/NavigationAnchors/schema.js +76 -0
- package/src/components/manage/Blocks/NavigationAnchors/styles.less +104 -0
- package/src/components/manage/Blocks/SimpleDataTable/index.js +16 -0
- package/src/components/manage/Blocks/SimpleDataTable/templates/colored/View.jsx +178 -0
- package/src/components/manage/Blocks/SimpleDataTable/templates/colored/index.js +4 -0
- package/src/components/manage/Blocks/SimpleDataTable/templates/colored/schema.js +56 -0
- package/src/components/manage/Blocks/SimpleDataTable/templates/colored/style.less +54 -0
- package/src/components/manage/Blocks/SiteBanner/View.jsx +148 -0
- package/src/components/manage/Blocks/SiteBanner/index.js +17 -0
- package/src/components/manage/Blocks/SiteBanner/schema.js +19 -0
- package/src/components/manage/Blocks/SiteBanner/style.less +106 -0
- package/src/components/manage/Blocks/SiteHabitatsList/View.jsx +89 -0
- package/src/components/manage/Blocks/SiteHabitatsList/index.js +17 -0
- package/src/components/manage/Blocks/SiteHabitatsList/schema.js +19 -0
- package/src/components/manage/Blocks/SiteHabitatsList/style.less +70 -0
- package/src/components/manage/Blocks/SiteProtectedHabitats/View.jsx +47 -0
- package/src/components/manage/Blocks/SiteProtectedHabitats/images/background.webp +0 -0
- package/src/components/manage/Blocks/SiteProtectedHabitats/index.js +17 -0
- package/src/components/manage/Blocks/SiteProtectedHabitats/schema.js +19 -0
- package/src/components/manage/Blocks/SiteProtectedHabitats/style.less +90 -0
- package/src/components/manage/Blocks/SiteProtectedSpecies/View.jsx +55 -0
- package/src/components/manage/Blocks/SiteProtectedSpecies/images/background.webp +0 -0
- package/src/components/manage/Blocks/SiteProtectedSpecies/index.js +17 -0
- package/src/components/manage/Blocks/SiteProtectedSpecies/schema.js +19 -0
- package/src/components/manage/Blocks/SiteProtectedSpecies/style.less +90 -0
- package/src/components/manage/Blocks/SiteShape/View.jsx +107 -0
- package/src/components/manage/Blocks/SiteShape/index.js +23 -0
- package/src/components/manage/Blocks/SiteShape/schema.js +19 -0
- package/src/components/manage/Blocks/SiteShape/style.less +15 -0
- package/src/components/manage/Blocks/SiteSpeciesList/Filters/SortBy.jsx +52 -0
- package/src/components/manage/Blocks/SiteSpeciesList/Filters/SpeciesGroups.jsx +43 -0
- package/src/components/manage/Blocks/SiteSpeciesList/Filters/View.jsx +200 -0
- package/src/components/manage/Blocks/SiteSpeciesList/Filters/index.js +4 -0
- package/src/components/manage/Blocks/SiteSpeciesList/View.jsx +253 -0
- package/src/components/manage/Blocks/SiteSpeciesList/index.js +17 -0
- package/src/components/manage/Blocks/SiteSpeciesList/schema.js +19 -0
- package/src/components/manage/Blocks/SiteSpeciesList/style.less +264 -0
- package/src/components/manage/Blocks/SiteSpeciesList/utils.js +33 -0
- package/src/components/manage/Blocks/SlateLink/render.jsx +77 -0
- package/src/components/manage/Blocks/SlateLink/styles.less +22 -0
- package/src/components/manage/Blocks/SlateSVG/constants.js +1 -0
- package/src/components/manage/Blocks/SlateSVG/extensions.js +11 -0
- package/src/components/manage/Blocks/SlateSVG/index.js +47 -0
- package/src/components/manage/Blocks/SlateSVG/render.jsx +42 -0
- package/src/components/manage/Blocks/SlateSVG/schema.js +12 -0
- package/src/components/manage/Blocks/SlateSVG/styles.less +6 -0
- package/src/components/manage/Blocks/SpeciesBanner/View.jsx +109 -0
- package/src/components/manage/Blocks/SpeciesBanner/index.js +17 -0
- package/src/components/manage/Blocks/SpeciesBanner/schema.js +19 -0
- package/src/components/manage/Blocks/SpeciesBanner/style.less +115 -0
- package/src/components/manage/Blocks/SpeciesClassification/View.jsx +19 -0
- package/src/components/manage/Blocks/SpeciesClassification/index.js +17 -0
- package/src/components/manage/Blocks/SpeciesClassification/schema.js +19 -0
- package/src/components/manage/Blocks/SpeciesClassification/style.less +3 -0
- package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +97 -0
- package/src/components/manage/Blocks/SpeciesDistribution/index.js +23 -0
- package/src/components/manage/Blocks/SpeciesDistribution/schema.js +19 -0
- package/src/components/manage/Blocks/SpeciesDistribution/style.less +5 -0
- package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +97 -0
- package/src/components/manage/Blocks/SpeciesProtectedSites/index.js +23 -0
- package/src/components/manage/Blocks/SpeciesProtectedSites/schema.js +19 -0
- package/src/components/manage/Blocks/SpeciesProtectedSites/style.less +5 -0
- package/src/components/manage/Blocks/StackedBarChart/Chart.jsx +127 -0
- package/src/components/manage/Blocks/StackedBarChart/ChartContext.jsx +3 -0
- package/src/components/manage/Blocks/StackedBarChart/StackedBars.jsx +116 -0
- package/src/components/manage/Blocks/StackedBarChart/View.jsx +64 -0
- package/src/components/manage/Blocks/StackedBarChart/index.js +17 -0
- package/src/components/manage/Blocks/StackedBarChart/schema.js +25 -0
- package/src/components/manage/Blocks/StackedBarChart/style.less +37 -0
- package/src/components/manage/Blocks/TilesImages/Edit.jsx +32 -0
- package/src/components/manage/Blocks/TilesImages/View.jsx +37 -0
- package/src/components/manage/Blocks/TilesImages/index.js +23 -0
- package/src/components/manage/Blocks/TilesImages/schema.js +72 -0
- package/src/components/manage/Blocks/TilesImages/styles.less +57 -0
- package/src/components/theme/AppExtras/CopyPaste/CopyPaste.jsx +176 -0
- package/src/components/theme/AppExtras/CopyPaste/index.js +3 -0
- package/src/components/theme/AppExtras/CopyPaste/style.less +18 -0
- package/src/components/theme/AppExtras/MultilingualRedirector/MultilingualRedirector.jsx +35 -0
- package/src/components/theme/AppExtras/index.js +13 -0
- package/src/components/theme/Footer/Footer.jsx +209 -0
- package/src/components/theme/Header/Header.jsx +81 -0
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +79 -0
- package/src/components/theme/LanguageSelector/styles.less +44 -0
- package/src/components/theme/Navigation/Navigation.jsx +453 -0
- package/src/components/theme/Sitemap/Sitemap.jsx +152 -0
- package/src/fonts/OpenSans-Bold.ttf +0 -0
- package/src/fonts/OpenSans-Regular.ttf +0 -0
- package/src/fonts/OpenSans-Semibold.ttf +0 -0
- package/src/fonts/Rajdhani-Bold.ttf +0 -0
- package/src/fonts/Rajdhani-Regular.ttf +0 -0
- package/src/grid.js +78 -0
- package/src/helpers.js +148 -0
- package/src/hocs/index.js +6 -0
- package/src/hocs/useResizeObserver.jsx +26 -0
- package/src/hocs/withLocalStorage.jsx +37 -0
- package/src/hocs/withScreenSize.jsx +43 -0
- package/src/icons/home.svg +12 -0
- package/src/icons/info.svg +5 -0
- package/src/icons/n2k-logo-transparent.png +0 -0
- package/src/icons/n2k-logo.png +0 -0
- package/src/icons/natura2000.svg +142 -0
- package/src/icons/placeholders/Algae.png +0 -0
- package/src/icons/placeholders/Amphibians.png +0 -0
- package/src/icons/placeholders/Birds.png +0 -0
- package/src/icons/placeholders/Conifers.png +0 -0
- package/src/icons/placeholders/Fishes.png +0 -0
- package/src/icons/placeholders/Fungi.png +0 -0
- package/src/icons/placeholders/Mammals.png +0 -0
- package/src/icons/placeholders/Plants.png +0 -0
- package/src/icons/placeholders/Reptiles.png +0 -0
- package/src/icons/placeholders/default.png +0 -0
- package/src/index.js +163 -0
- package/src/less/globals.less +3 -0
- package/src/less/styles.less +691 -0
- package/src/less/variables.less +2 -0
- package/src/static/cca.svg +61 -0
- package/src/static/ec.png +0 -0
- package/src/static/eea.png +0 -0
- package/src/static/eu.jpg +0 -0
- package/src/static/forest.svg +100 -0
- package/src/static/wise.png +0 -0
- package/src/store.js +24 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation components.
|
|
3
|
+
* @module components/theme/Navigation/Navigation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { connect } from 'react-redux';
|
|
9
|
+
import { compose } from 'redux';
|
|
10
|
+
import { matchPath, withRouter } from 'react-router';
|
|
11
|
+
import { Link } from 'react-router-dom';
|
|
12
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
13
|
+
import { Menu, Dropdown } from 'semantic-ui-react';
|
|
14
|
+
import cx from 'classnames';
|
|
15
|
+
import { getBaseUrl, flattenToAppURL } from '@plone/volto/helpers';
|
|
16
|
+
import { UniversalLink, Icon } from '@plone/volto/components';
|
|
17
|
+
import qs from 'querystring';
|
|
18
|
+
import { getNavigation } from '@plone/volto/actions';
|
|
19
|
+
import config from '@plone/volto/registry';
|
|
20
|
+
import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
21
|
+
import LanguageSelector from '../LanguageSelector/LanguageSelector';
|
|
22
|
+
import n2kLogo from '@eeacms/volto-n2k/icons/natura2000.svg';
|
|
23
|
+
|
|
24
|
+
const messages = defineMessages({
|
|
25
|
+
closeMobileMenu: {
|
|
26
|
+
id: 'Close menu',
|
|
27
|
+
defaultMessage: 'Close menu',
|
|
28
|
+
},
|
|
29
|
+
openMobileMenu: {
|
|
30
|
+
id: 'Open menu',
|
|
31
|
+
defaultMessage: 'Open menu',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const Hamburger = (props) => (
|
|
36
|
+
<div className="hamburger-wrapper mobile only">
|
|
37
|
+
<button
|
|
38
|
+
className={cx('hamburger hamburger--collapse', {
|
|
39
|
+
'is-active': props.isMobileMenuOpen,
|
|
40
|
+
})}
|
|
41
|
+
aria-label={
|
|
42
|
+
props.isMobileMenuOpen
|
|
43
|
+
? props.intl.formatMessage(messages.closeMobileMenu, {
|
|
44
|
+
type: props.type,
|
|
45
|
+
})
|
|
46
|
+
: props.intl.formatMessage(messages.openMobileMenu, {
|
|
47
|
+
type: props.type,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
title={
|
|
51
|
+
props.isMobileMenuOpen
|
|
52
|
+
? props.intl.formatMessage(messages.closeMobileMenu, {
|
|
53
|
+
type: props.type,
|
|
54
|
+
})
|
|
55
|
+
: props.intl.formatMessage(messages.openMobileMenu, {
|
|
56
|
+
type: props.type,
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
type="button"
|
|
60
|
+
onClick={props.toggleMobileMenu}
|
|
61
|
+
>
|
|
62
|
+
<span className="hamburger-box">
|
|
63
|
+
<span className="hamburger-inner" />
|
|
64
|
+
</span>
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Navigation container class.
|
|
71
|
+
* @class Navigation
|
|
72
|
+
* @extends Component
|
|
73
|
+
*/
|
|
74
|
+
class Navigation extends Component {
|
|
75
|
+
/**
|
|
76
|
+
* Property types.
|
|
77
|
+
* @property {Object} propTypes Property types.
|
|
78
|
+
* @static
|
|
79
|
+
*/
|
|
80
|
+
static propTypes = {
|
|
81
|
+
getNavigation: PropTypes.func.isRequired,
|
|
82
|
+
pathname: PropTypes.string.isRequired,
|
|
83
|
+
items: PropTypes.arrayOf(
|
|
84
|
+
PropTypes.shape({
|
|
85
|
+
title: PropTypes.string,
|
|
86
|
+
url: PropTypes.string,
|
|
87
|
+
items: PropTypes.array,
|
|
88
|
+
}),
|
|
89
|
+
).isRequired,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Constructor
|
|
94
|
+
* @method constructor
|
|
95
|
+
* @param {Object} props Component properties
|
|
96
|
+
* @constructs Navigation
|
|
97
|
+
*/
|
|
98
|
+
constructor(props) {
|
|
99
|
+
super(props);
|
|
100
|
+
this.toggleMobileMenu = this.toggleMobileMenu.bind(this);
|
|
101
|
+
this.closeMobileMenu = this.closeMobileMenu.bind(this);
|
|
102
|
+
this.state = {
|
|
103
|
+
isMobileMenuOpen: false,
|
|
104
|
+
isSdf: false,
|
|
105
|
+
};
|
|
106
|
+
this.container = React.createRef();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Component will mount
|
|
111
|
+
* @method componentWillMount
|
|
112
|
+
* @returns {undefined}
|
|
113
|
+
*/
|
|
114
|
+
componentDidMount() {
|
|
115
|
+
this.props.getNavigation(
|
|
116
|
+
getBaseUrl(this.props.pathname),
|
|
117
|
+
config.settings.navDepth,
|
|
118
|
+
);
|
|
119
|
+
this.setState({
|
|
120
|
+
isSdf: this.isSdf(),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
handleClickOutsideNav = (event) => {
|
|
125
|
+
if (
|
|
126
|
+
this.container.current &&
|
|
127
|
+
!this.container.current.contains(event.target)
|
|
128
|
+
) {
|
|
129
|
+
this.setState({
|
|
130
|
+
isMobileMenuOpen: false,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Component did update
|
|
137
|
+
* @method componentDidUpdate
|
|
138
|
+
* @param {Object} prevProps Prev properties
|
|
139
|
+
* @returns {undefined}
|
|
140
|
+
*/
|
|
141
|
+
componentDidUpdate(prevProps) {
|
|
142
|
+
if (
|
|
143
|
+
prevProps.pathname !== this.props.pathname ||
|
|
144
|
+
prevProps.userToken !== this.props.userToken
|
|
145
|
+
) {
|
|
146
|
+
this.props.getNavigation(
|
|
147
|
+
getBaseUrl(this.props.pathname),
|
|
148
|
+
config.settings.navDepth,
|
|
149
|
+
);
|
|
150
|
+
this.closeMobileMenu();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Hide submenu on route change
|
|
154
|
+
if (document.querySelector('body')) {
|
|
155
|
+
document.querySelector('body').click();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Check if menu is active
|
|
161
|
+
* @method isActive
|
|
162
|
+
* @param {string} url Url of the navigation item.
|
|
163
|
+
* @returns {bool} Is menu active?
|
|
164
|
+
*/
|
|
165
|
+
isActive(url) {
|
|
166
|
+
return (
|
|
167
|
+
(url === '' && this.props.pathname === '/') ||
|
|
168
|
+
// (url !== '' && isMatch(this.props.pathname.split('/'), url.split('/')))
|
|
169
|
+
(url !== '' && url === this.props.pathname)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Check if page si sdf
|
|
175
|
+
* @method isSdf
|
|
176
|
+
* @returns {bool} Is sdf?
|
|
177
|
+
*/
|
|
178
|
+
isSdf() {
|
|
179
|
+
if (
|
|
180
|
+
matchPath(this.props.pathname, {
|
|
181
|
+
path: config.settings.sdf,
|
|
182
|
+
exact: true,
|
|
183
|
+
strict: false,
|
|
184
|
+
})
|
|
185
|
+
) {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Toggle mobile menu's open state
|
|
193
|
+
* @method toggleMobileMenu
|
|
194
|
+
* @returns {undefined}
|
|
195
|
+
*/
|
|
196
|
+
toggleMobileMenu() {
|
|
197
|
+
this.setState({ isMobileMenuOpen: !this.state.isMobileMenuOpen }, () => {
|
|
198
|
+
if (this.state.isMobileMenuOpen) {
|
|
199
|
+
document.addEventListener('mousedown', this.handleClickOutsideNav);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Close mobile menu
|
|
206
|
+
* @method closeMobileMenu
|
|
207
|
+
* @returns {undefined}
|
|
208
|
+
*/
|
|
209
|
+
closeMobileMenu() {
|
|
210
|
+
if (!this.state.isMobileMenuOpen) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
this.setState({ isMobileMenuOpen: false }, () => {
|
|
214
|
+
document.removeEventListener('mousedown', this.handleClickOutsideNav);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Render method.
|
|
220
|
+
* @method render
|
|
221
|
+
* @returns {string} Markup for the component.
|
|
222
|
+
*/
|
|
223
|
+
render() {
|
|
224
|
+
const params = {
|
|
225
|
+
...this.props.match.params,
|
|
226
|
+
...(this.props.route_parameters || {}),
|
|
227
|
+
...qs.parse(this.props.location.search.replace('?', '')),
|
|
228
|
+
};
|
|
229
|
+
return (
|
|
230
|
+
<nav
|
|
231
|
+
className={cx('navigation', this.props.className || '')}
|
|
232
|
+
ref={this.container}
|
|
233
|
+
>
|
|
234
|
+
<div className="mobile only">
|
|
235
|
+
<Hamburger
|
|
236
|
+
{...this.props}
|
|
237
|
+
isMobileMenuOpen={this.state.isMobileMenuOpen}
|
|
238
|
+
toggleMobileMenu={this.toggleMobileMenu}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
<Menu
|
|
242
|
+
stackable
|
|
243
|
+
pointing
|
|
244
|
+
secondary
|
|
245
|
+
className={cx({
|
|
246
|
+
open: this.state.isMobileMenuOpen,
|
|
247
|
+
'is-sdf': this.state.isSdf,
|
|
248
|
+
'is-sticky': this.state.isSdf || this.props.isSticky,
|
|
249
|
+
'mobile hidden': !this.state.isMobileMenuOpen,
|
|
250
|
+
'mobile only': this.state.isMobileMenuOpen,
|
|
251
|
+
})}
|
|
252
|
+
onClick={this.closeMobileMenu}
|
|
253
|
+
onBlur={() => this.closeMobileMenu}
|
|
254
|
+
>
|
|
255
|
+
<div className="mobile only">
|
|
256
|
+
<Hamburger
|
|
257
|
+
{...this.props}
|
|
258
|
+
isMobileMenuOpen={this.state.isMobileMenuOpen}
|
|
259
|
+
toggleMobileMenu={this.toggleMobileMenu}
|
|
260
|
+
/>
|
|
261
|
+
</div>
|
|
262
|
+
<Menu.Item className="home-button logo">
|
|
263
|
+
<Link title="Natura 2000" to="/natura2000">
|
|
264
|
+
<Icon name={n2kLogo} size={44} />
|
|
265
|
+
</Link>
|
|
266
|
+
</Menu.Item>
|
|
267
|
+
{this.state.isSdf ? (
|
|
268
|
+
<>
|
|
269
|
+
<button
|
|
270
|
+
to={this.props.pathname}
|
|
271
|
+
title="At a glance"
|
|
272
|
+
className="item firstLevel at-glance"
|
|
273
|
+
onClick={() => {
|
|
274
|
+
window.scrollTo({
|
|
275
|
+
top: document.body.scrollHeight,
|
|
276
|
+
behavior: 'smooth',
|
|
277
|
+
});
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
AT A GLANCE
|
|
281
|
+
</button>
|
|
282
|
+
|
|
283
|
+
<UniversalLink
|
|
284
|
+
href={
|
|
285
|
+
params.site_code
|
|
286
|
+
? `https://natura2000.eea.europa.eu/Natura2000/SDF.aspx?site=${params.site_code}`
|
|
287
|
+
: '#'
|
|
288
|
+
}
|
|
289
|
+
openLinkInNewTab={true}
|
|
290
|
+
title="Deep dive"
|
|
291
|
+
className="item firstLevel deep-dive"
|
|
292
|
+
>
|
|
293
|
+
DEEP DIVE
|
|
294
|
+
</UniversalLink>
|
|
295
|
+
</>
|
|
296
|
+
) : (
|
|
297
|
+
''
|
|
298
|
+
)}
|
|
299
|
+
|
|
300
|
+
{!this.state.isSdf
|
|
301
|
+
? this.props.items.map((item) => {
|
|
302
|
+
const flatUrl = flattenToAppURL(item.url);
|
|
303
|
+
const itemID = item.title.split(' ').join('-').toLowerCase();
|
|
304
|
+
return item.items && item.items.length && false ? (
|
|
305
|
+
<Dropdown
|
|
306
|
+
id={itemID}
|
|
307
|
+
className={cx({
|
|
308
|
+
item: true,
|
|
309
|
+
firstLevel: true,
|
|
310
|
+
menuActive: this.isActive(flatUrl),
|
|
311
|
+
})}
|
|
312
|
+
key={flatUrl}
|
|
313
|
+
trigger={
|
|
314
|
+
<Link to={flatUrl === '' ? '/' : flatUrl} key={flatUrl}>
|
|
315
|
+
{item.title}
|
|
316
|
+
</Link>
|
|
317
|
+
}
|
|
318
|
+
item
|
|
319
|
+
simple
|
|
320
|
+
>
|
|
321
|
+
<Dropdown.Menu>
|
|
322
|
+
{item.items.map((subitem) => {
|
|
323
|
+
const flatSubUrl = flattenToAppURL(subitem.url);
|
|
324
|
+
const subItemID = subitem.title
|
|
325
|
+
.split(' ')
|
|
326
|
+
.join('-')
|
|
327
|
+
.toLowerCase();
|
|
328
|
+
return (
|
|
329
|
+
<Dropdown.Item key={flatSubUrl}>
|
|
330
|
+
<div className="secondLevel-wrapper">
|
|
331
|
+
<Link
|
|
332
|
+
id={subItemID}
|
|
333
|
+
to={flatSubUrl === '' ? '/' : flatSubUrl}
|
|
334
|
+
key={flatSubUrl}
|
|
335
|
+
className={
|
|
336
|
+
this.isActive(flatSubUrl)
|
|
337
|
+
? 'item secondLevel menuActive'
|
|
338
|
+
: 'item secondLevel'
|
|
339
|
+
}
|
|
340
|
+
>
|
|
341
|
+
{subitem.title}
|
|
342
|
+
</Link>
|
|
343
|
+
</div>
|
|
344
|
+
{subitem.items && (
|
|
345
|
+
<div className="submenu-wrapper">
|
|
346
|
+
<div className="submenu">
|
|
347
|
+
{subitem.items.map((subsubitem) => {
|
|
348
|
+
const flatSubSubUrl = flattenToAppURL(
|
|
349
|
+
subsubitem.url,
|
|
350
|
+
);
|
|
351
|
+
return (
|
|
352
|
+
<Link
|
|
353
|
+
to={
|
|
354
|
+
flatSubSubUrl === ''
|
|
355
|
+
? '/'
|
|
356
|
+
: flatSubSubUrl
|
|
357
|
+
}
|
|
358
|
+
title={subsubitem.title}
|
|
359
|
+
key={flatSubSubUrl}
|
|
360
|
+
className={
|
|
361
|
+
this.isActive(flatSubSubUrl)
|
|
362
|
+
? 'item thirdLevel menuActive'
|
|
363
|
+
: 'item thirdLevel'
|
|
364
|
+
}
|
|
365
|
+
>
|
|
366
|
+
{subsubitem.title}
|
|
367
|
+
</Link>
|
|
368
|
+
);
|
|
369
|
+
})}
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
)}
|
|
373
|
+
</Dropdown.Item>
|
|
374
|
+
);
|
|
375
|
+
})}
|
|
376
|
+
</Dropdown.Menu>
|
|
377
|
+
</Dropdown>
|
|
378
|
+
) : (
|
|
379
|
+
<Link
|
|
380
|
+
to={flatUrl === '' ? '/' : flatUrl}
|
|
381
|
+
key={flatUrl}
|
|
382
|
+
className={
|
|
383
|
+
this.isActive(flatUrl)
|
|
384
|
+
? 'item menuActive firstLevel'
|
|
385
|
+
: 'item firstLevel'
|
|
386
|
+
}
|
|
387
|
+
>
|
|
388
|
+
{item.title}
|
|
389
|
+
</Link>
|
|
390
|
+
);
|
|
391
|
+
})
|
|
392
|
+
: ''}
|
|
393
|
+
{!this.state.isSdf ? (
|
|
394
|
+
<Menu.Item className="firstLevel language-selector-wrapper">
|
|
395
|
+
<LanguageSelector navigation={this.props.navigation} />
|
|
396
|
+
</Menu.Item>
|
|
397
|
+
) : (
|
|
398
|
+
''
|
|
399
|
+
)}
|
|
400
|
+
</Menu>
|
|
401
|
+
</nav>
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const getN2kItems = (items, localStorage) => {
|
|
407
|
+
if (__SERVER__) return [];
|
|
408
|
+
const currentLang = localStorage.get('N2K_LANGUAGE');
|
|
409
|
+
let navItems = [];
|
|
410
|
+
const natura2000 =
|
|
411
|
+
items.filter((item) => item.url === '/natura2000')?.[0]?.items || [];
|
|
412
|
+
natura2000.forEach((item) => {
|
|
413
|
+
const languageFolder = matchPath(item.url, {
|
|
414
|
+
path: config.settings.multilingualRoot,
|
|
415
|
+
exact: true,
|
|
416
|
+
strict: false,
|
|
417
|
+
});
|
|
418
|
+
if (languageFolder && languageFolder.params.lang === currentLang) {
|
|
419
|
+
navItems = [...navItems, ...(item.items || [])];
|
|
420
|
+
}
|
|
421
|
+
if (
|
|
422
|
+
languageFolder &&
|
|
423
|
+
!config.settings.supportedLanguages.includes(
|
|
424
|
+
languageFolder.params.lang,
|
|
425
|
+
) &&
|
|
426
|
+
item.url !== '/natura2000/sites' &&
|
|
427
|
+
item.url !== '/natura2000/habitats' &&
|
|
428
|
+
item.url !== '/natura2000/species' &&
|
|
429
|
+
item.url !== '/natura2000/copyright-notice'
|
|
430
|
+
) {
|
|
431
|
+
navItems.push(item);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
return navItems;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
export default compose(
|
|
439
|
+
withRouter,
|
|
440
|
+
withLocalStorage,
|
|
441
|
+
injectIntl,
|
|
442
|
+
connect(
|
|
443
|
+
(state, props) => {
|
|
444
|
+
return {
|
|
445
|
+
route_parameters: state.route_parameters,
|
|
446
|
+
navigation: state.navigation,
|
|
447
|
+
items: getN2kItems(state.navigation.items, props.localStorage),
|
|
448
|
+
userToken: state?.userSession?.token,
|
|
449
|
+
};
|
|
450
|
+
},
|
|
451
|
+
{ getNavigation },
|
|
452
|
+
),
|
|
453
|
+
)(Navigation);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Login container.
|
|
3
|
+
* @module components/theme/Sitemap/Sitemap
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { compose } from 'redux';
|
|
9
|
+
import { connect } from 'react-redux';
|
|
10
|
+
import { matchPath } from 'react-router';
|
|
11
|
+
import { asyncConnect } from '@plone/volto/helpers';
|
|
12
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
13
|
+
import { Container } from 'semantic-ui-react';
|
|
14
|
+
import { Helmet } from '@plone/volto/helpers';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
16
|
+
import config from '@plone/volto/registry';
|
|
17
|
+
import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
18
|
+
|
|
19
|
+
import { getNavigation } from '@plone/volto/actions';
|
|
20
|
+
|
|
21
|
+
const messages = defineMessages({
|
|
22
|
+
Sitemap: {
|
|
23
|
+
id: 'Sitemap',
|
|
24
|
+
defaultMessage: 'Sitemap',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Sitemap class.
|
|
29
|
+
* @class Sitemap
|
|
30
|
+
* @extends Component
|
|
31
|
+
*/
|
|
32
|
+
class Sitemap extends Component {
|
|
33
|
+
/**
|
|
34
|
+
* Property types.
|
|
35
|
+
* @property {Object} propTypes Property types.
|
|
36
|
+
* @static
|
|
37
|
+
*/
|
|
38
|
+
static propTypes = {
|
|
39
|
+
getNavigation: PropTypes.func.isRequired,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
const { settings } = config;
|
|
44
|
+
if (settings.isMultilingual) {
|
|
45
|
+
this.props.getNavigation(`${this.props.lang}`, 4);
|
|
46
|
+
} else {
|
|
47
|
+
this.props.getNavigation('', 4);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Render method.
|
|
53
|
+
* @method render
|
|
54
|
+
* @returns {string} Markup for the component.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
renderItems = (items) => {
|
|
58
|
+
return (
|
|
59
|
+
<ul>
|
|
60
|
+
{items.map((item) => (
|
|
61
|
+
<li
|
|
62
|
+
key={item.url}
|
|
63
|
+
className={item.items?.length > 0 ? 'with-children' : ''}
|
|
64
|
+
>
|
|
65
|
+
<Link to={item.url}>{item.title}</Link>
|
|
66
|
+
{item.items && this.renderItems(item.items)}
|
|
67
|
+
</li>
|
|
68
|
+
))}
|
|
69
|
+
</ul>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
render() {
|
|
73
|
+
const { items } = this.props;
|
|
74
|
+
return (
|
|
75
|
+
<div id="page-sitemap">
|
|
76
|
+
<Helmet title={this.props.intl.formatMessage(messages.Sitemap)} />
|
|
77
|
+
<Container className="view-wrapper">
|
|
78
|
+
<h1>{this.props.intl.formatMessage(messages.Sitemap)} </h1>
|
|
79
|
+
{items && this.renderItems(items)}
|
|
80
|
+
</Container>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const getN2kItems = (items, localStorage) => {
|
|
87
|
+
if (__SERVER__) return [];
|
|
88
|
+
const currentLang = localStorage.get('N2K_LANGUAGE');
|
|
89
|
+
let navItems = [];
|
|
90
|
+
const natura2000 =
|
|
91
|
+
items.filter((item) => item.url === '/natura2000')?.[0]?.items || [];
|
|
92
|
+
natura2000.forEach((item) => {
|
|
93
|
+
const languageFolder = matchPath(item.url, {
|
|
94
|
+
path: config.settings.multilingualRoot,
|
|
95
|
+
exact: true,
|
|
96
|
+
strict: false,
|
|
97
|
+
});
|
|
98
|
+
if (languageFolder && languageFolder.params.lang === currentLang) {
|
|
99
|
+
navItems = [...navItems, ...(item.items || [])];
|
|
100
|
+
}
|
|
101
|
+
if (
|
|
102
|
+
languageFolder &&
|
|
103
|
+
!config.settings.supportedLanguages.includes(
|
|
104
|
+
languageFolder.params.lang,
|
|
105
|
+
) &&
|
|
106
|
+
item.url !== '/natura2000/sites' &&
|
|
107
|
+
item.url !== '/natura2000/habitats' &&
|
|
108
|
+
item.url !== '/natura2000/species'
|
|
109
|
+
) {
|
|
110
|
+
navItems.push(item);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return navItems;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const __test__ = compose(
|
|
118
|
+
injectIntl,
|
|
119
|
+
connect(
|
|
120
|
+
(state) => ({
|
|
121
|
+
items: state.navigation.items,
|
|
122
|
+
lang: state.intl.locale,
|
|
123
|
+
}),
|
|
124
|
+
{ getNavigation },
|
|
125
|
+
),
|
|
126
|
+
)(Sitemap);
|
|
127
|
+
|
|
128
|
+
export default compose(
|
|
129
|
+
injectIntl,
|
|
130
|
+
withLocalStorage,
|
|
131
|
+
connect(
|
|
132
|
+
(state, props) => ({
|
|
133
|
+
items: getN2kItems(state.navigation.items, props.localStorage),
|
|
134
|
+
lang: state.intl.locale,
|
|
135
|
+
}),
|
|
136
|
+
{ getNavigation },
|
|
137
|
+
),
|
|
138
|
+
asyncConnect([
|
|
139
|
+
{
|
|
140
|
+
key: 'navigation',
|
|
141
|
+
promise: ({ location, store: { dispatch, getState } }) => {
|
|
142
|
+
const { settings } = config;
|
|
143
|
+
const lang = getState().intl.locale;
|
|
144
|
+
if (settings.isMultilingual) {
|
|
145
|
+
return __SERVER__ && dispatch(getNavigation(`${lang}`, 4));
|
|
146
|
+
} else {
|
|
147
|
+
return __SERVER__ && dispatch(getNavigation('', 4));
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
]),
|
|
152
|
+
)(Sitemap);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grid.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import codeSVG from '@plone/volto/icons/code.svg';
|
|
2
|
+
|
|
3
|
+
export const gridSizes = {};
|
|
4
|
+
|
|
5
|
+
export const variants = [
|
|
6
|
+
{
|
|
7
|
+
icon: codeSVG,
|
|
8
|
+
defaultData: {
|
|
9
|
+
gridSize: 12,
|
|
10
|
+
gridCols: ['twoFifths', 'threeFifths'],
|
|
11
|
+
},
|
|
12
|
+
title: '40 / 60',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
icon: codeSVG,
|
|
16
|
+
defaultData: {
|
|
17
|
+
gridSize: 12,
|
|
18
|
+
gridCols: ['twoFifths'],
|
|
19
|
+
},
|
|
20
|
+
title: '40',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
icon: codeSVG,
|
|
24
|
+
defaultData: {
|
|
25
|
+
gridSize: 12,
|
|
26
|
+
gridCols: ['halfWidthBig'],
|
|
27
|
+
},
|
|
28
|
+
title: '50',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
icon: codeSVG,
|
|
32
|
+
defaultData: {
|
|
33
|
+
gridSize: 12,
|
|
34
|
+
gridCols: ['threeFifths'],
|
|
35
|
+
},
|
|
36
|
+
title: '60',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
icon: codeSVG,
|
|
40
|
+
defaultData: {
|
|
41
|
+
gridSize: 12,
|
|
42
|
+
gridCols: ['twoThirds'],
|
|
43
|
+
},
|
|
44
|
+
title: '70',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
icon: codeSVG,
|
|
48
|
+
defaultData: {
|
|
49
|
+
gridSize: 12,
|
|
50
|
+
gridCols: ['fourFifths'],
|
|
51
|
+
},
|
|
52
|
+
title: '80',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
icon: codeSVG,
|
|
56
|
+
defaultData: {
|
|
57
|
+
gridSize: 12,
|
|
58
|
+
gridCols: ['full', 'halfWidth', 'halfWidth'],
|
|
59
|
+
},
|
|
60
|
+
title: '100 / 50 / 50',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
icon: codeSVG,
|
|
64
|
+
defaultData: {
|
|
65
|
+
gridSize: 12,
|
|
66
|
+
gridCols: ['halfWidth', 'halfWidth', 'full'],
|
|
67
|
+
},
|
|
68
|
+
title: '50 / 50 / 100',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
icon: codeSVG,
|
|
72
|
+
defaultData: {
|
|
73
|
+
gridSize: 12,
|
|
74
|
+
gridCols: ['full', 'halfWidth', 'halfWidth', 'full'],
|
|
75
|
+
},
|
|
76
|
+
title: '100 / 50 / 50 / 100',
|
|
77
|
+
},
|
|
78
|
+
];
|