@eeacms/volto-n2k 1.0.22 → 1.0.24

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/package.json +3 -2
  3. package/src/components/manage/Blocks/BodyClass/index.js +1 -1
  4. package/src/components/manage/Blocks/CddaShape/View.jsx +2 -2
  5. package/src/components/manage/Blocks/ContactBlock/styles.less +1 -1
  6. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +2 -2
  7. package/src/components/manage/Blocks/ExploreSites/View.jsx +2 -2
  8. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +2 -2
  9. package/src/components/manage/Blocks/HabitatDistribution/View.jsx +2 -2
  10. package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +2 -2
  11. package/src/components/manage/Blocks/HabitatsBanner/Edit.jsx +49 -0
  12. package/src/components/manage/Blocks/HabitatsBanner/View.jsx +184 -21
  13. package/src/components/manage/Blocks/HabitatsBanner/index.js +18 -11
  14. package/src/components/manage/Blocks/HabitatsBanner/schema.js +64 -5
  15. package/src/components/manage/Blocks/HabitatsBanner/style.less +184 -17
  16. package/src/components/manage/Blocks/Landing/index.js +3 -2
  17. package/src/components/manage/Blocks/Landing/style.less +3 -5
  18. package/src/components/manage/Blocks/NavigationAnchors/View.jsx +1 -1
  19. package/src/components/manage/Blocks/NavigationAnchors/styles.less +2 -0
  20. package/src/components/manage/Blocks/SiteBanner/style.less +8 -0
  21. package/src/components/manage/Blocks/SiteShape/View.jsx +1 -1
  22. package/src/components/manage/Blocks/SiteSpeciesList/style.less +1 -1
  23. package/src/components/manage/Blocks/SpeciesBanner/View.jsx +160 -100
  24. package/src/components/manage/Blocks/SpeciesBanner/style.less +161 -72
  25. package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +2 -2
  26. package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +2 -2
  27. package/src/icons/arrow-left.svg +9 -0
  28. package/src/icons/arrow-right.svg +9 -0
@@ -1,30 +1,81 @@
1
+ @type: extra;
2
+ @element: custom;
3
+
4
+ @import (multiple, reference, optional) '../../theme.config';
5
+
6
+ @import 'swiper/swiper.less';
7
+
8
+ @{view} {
9
+ .habitat-banner-details {
10
+ &::before {
11
+ .full-width();
12
+ position: absolute;
13
+ z-index: -1;
14
+ }
15
+
16
+ .carousel {
17
+ .half-width(960px);
18
+
19
+ @media @mobile {
20
+ width: calc(@pageFullWidth - 2rem) !important;
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ @{edit} {
27
+ .habitat-banner-details {
28
+ &::before {
29
+ .full-width-edit();
30
+ position: absolute;
31
+ z-index: -1;
32
+ }
33
+
34
+ .carousel {
35
+ .half-width-edit(960px);
36
+
37
+ @media @mobile {
38
+ width: calc(@pageFullWidthEdit - 2rem) !important;
39
+ }
40
+ }
41
+ }
42
+ }
43
+
1
44
  div#view .habitat-banner-details .ui.container > * {
45
+ margin-top: 0;
2
46
  margin-bottom: 0;
3
47
  }
4
48
 
5
49
  .habitat-banner-details {
6
- padding: 1.5em 0;
7
- background-color: #00a390;
50
+ position: relative;
51
+ padding: 0;
52
+ margin-bottom: 1rem;
8
53
  color: #fff !important;
9
54
  font-family: 'RajdhaniB', 'Helvetica Neue', Arial, Helvetica, sans-serif;
10
55
 
56
+ &::before {
57
+ display: block;
58
+ height: 100%;
59
+ background-color: #00a390;
60
+ content: '';
61
+ }
62
+
11
63
  .habitat-details {
12
64
  display: flex;
13
- align-items: flex-start;
65
+ align-items: center;
14
66
  justify-content: space-between;
15
- gap: 1rem;
16
-
17
- @media only screen and (max-width: 765px) {
18
- flex-flow: column;
19
-
20
- .habitat-metadata {
21
- margin-bottom: 1rem;
22
- }
23
- }
24
67
 
25
68
  .habitat-metadata {
69
+ display: flex;
70
+ width: 50%;
71
+ height: 320px !important;
72
+ flex: 0 0 50%;
73
+ flex-direction: column;
74
+ justify-content: center;
75
+ word-wrap: break-word;
76
+
26
77
  .name {
27
- margin-top: 0.5em !important;
78
+ margin-top: 0 !important;
28
79
  margin-bottom: 0 !important;
29
80
  color: #fff !important;
30
81
  font-family: inherit;
@@ -39,6 +90,10 @@ div#view .habitat-banner-details .ui.container > * {
39
90
  }
40
91
  }
41
92
 
93
+ .info {
94
+ margin-bottom: 0;
95
+ }
96
+
42
97
  h3 {
43
98
  margin-top: 0 !important;
44
99
  margin-bottom: 0 !important;
@@ -65,13 +120,125 @@ div#view .habitat-banner-details .ui.container > * {
65
120
  font-size: 18px;
66
121
  font-weight: 600;
67
122
  line-height: 18px;
123
+
124
+ a {
125
+ color: #fff;
126
+
127
+ &:hover {
128
+ color: #fff;
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ .carousel {
135
+ display: flex;
136
+ height: 320px;
137
+
138
+ p {
139
+ font-family: 'RajdhaniB', 'Helvetica Neue', Arial, Helvetica, sans-serif;
140
+ }
141
+
142
+ img {
143
+ width: 100%;
144
+ }
145
+
146
+ &.one-slide .swiper {
147
+ width: 100%;
148
+ }
149
+
150
+ &.two-slides .swiper {
151
+ width: 50%;
152
+
153
+ @media @mobile {
154
+ width: 100%;
155
+
156
+ &.preview.preview-one {
157
+ display: none;
158
+ }
159
+ }
160
+ }
161
+
162
+ &.three-slides .swiper {
163
+ width: 33.33%;
164
+
165
+ @media @tablet {
166
+ width: 50%;
167
+
168
+ &.preview.preview-two {
169
+ display: none;
170
+ }
171
+ }
172
+
173
+ @media @mobile {
174
+ width: 100%;
175
+
176
+ &.preview.preview-two,
177
+ &.preview.preview-one {
178
+ display: none;
179
+ }
180
+ }
181
+ }
182
+
183
+ .swiper {
184
+ &.preview .swiper-slide {
185
+ filter: grayscale(100%);
186
+ }
187
+
188
+ img {
189
+ display: block;
190
+ width: 100%;
191
+ height: 100%;
192
+ object-fit: cover;
193
+ }
194
+ }
195
+
196
+ .arrows {
197
+ position: absolute;
198
+ z-index: 2;
199
+ bottom: 0;
200
+ left: 0;
201
+ display: flex;
202
+ width: 100%;
203
+ align-items: center;
204
+
205
+ button {
206
+ padding: 0;
207
+ border: none;
208
+ margin: 0;
209
+ background-color: transparent;
210
+ }
211
+
212
+ .icon {
213
+ display: block;
214
+ width: 32px;
215
+ background-color: #fff;
216
+ cursor: pointer;
217
+ }
218
+
219
+ p {
220
+ overflow: hidden;
221
+ width: calc(100% - 64px);
222
+ padding: 0.25rem 0.25rem 0.25rem 1rem;
223
+ margin: 0;
224
+ backdrop-filter: brightness(0.5);
225
+ text-overflow: ellipsis;
226
+ white-space: nowrap;
227
+ }
68
228
  }
69
229
  }
70
230
 
71
- img {
72
- max-height: 200px;
73
- border-radius: 10px;
74
- filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.4));
231
+ @media @mobile {
232
+ flex-flow: column;
233
+
234
+ .habitat-metadata {
235
+ width: 100%;
236
+ margin-top: 2rem;
237
+ }
238
+
239
+ .carousel {
240
+ margin: 0 1rem 1rem 1rem;
241
+ }
75
242
  }
76
243
  }
77
244
  }
@@ -75,8 +75,9 @@ export const getStyle = (props) => {
75
75
  if (!props.screen.width || !props.screen.height) return {};
76
76
  const height =
77
77
  props.screen.height -
78
- props.screen.browserToolbarHeight -
79
- props.screen.content.offsetTop;
78
+ props.screen.content.offsetTop -
79
+ props.screen.browserToolbarHeight;
80
+
80
81
  return {
81
82
  minHeight: `${height}px`,
82
83
  maxHeight: `${height}px`,
@@ -11,12 +11,10 @@
11
11
  background-repeat: no-repeat;
12
12
  background-size: cover;
13
13
 
14
- &:not(.edit) {
15
- overflow-y: hidden;
14
+ overflow-y: hidden;
16
15
 
17
- .ui.grid.landing-page {
18
- overflow-y: auto;
19
- }
16
+ .ui.grid.landing-page {
17
+ overflow-y: auto;
20
18
  }
21
19
 
22
20
  .ui.grid.landing-page {
@@ -69,7 +69,7 @@ const View = (props) => {
69
69
 
70
70
  return (
71
71
  <Sticky
72
- active={sticky && screen.page?.width > 765}
72
+ active={sticky && screen.page?.width > 767}
73
73
  context={__CLIENT__ && document.querySelector('.content-area')}
74
74
  className={cx('sticky-navigation-anchors', {
75
75
  'full-width': sticky,
@@ -15,6 +15,8 @@ div#view .ui.container > .sticky-navigation-anchors {
15
15
  }
16
16
 
17
17
  .sticky-navigation-anchors {
18
+ z-index: 5 !important;
19
+
18
20
  &.is-sticky {
19
21
  .navigation-anchors {
20
22
  background-color: #fff !important;
@@ -2,6 +2,14 @@
2
2
  margin-top: 0;
3
3
  }
4
4
 
5
+ .subsite.subsite-natura2000 .content-area {
6
+ .site-banner {
7
+ h2 {
8
+ color: #fff !important;
9
+ }
10
+ }
11
+ }
12
+
5
13
  .site-banner {
6
14
  padding: 1.5em 0;
7
15
  background-color: #00a390;
@@ -105,7 +105,7 @@ const View = (props) => {
105
105
  />
106
106
  </Map>
107
107
  </div>
108
- <Message className="map-info-notice">
108
+ <Message className="map-info-notice shadow-none">
109
109
  <Container>
110
110
  <p>
111
111
  The designations employed and the presentation of material on this
@@ -5,7 +5,7 @@ div#view .site-species-list .species-list .ui.container > * {
5
5
  }
6
6
 
7
7
  .site-species-list {
8
- margin-top: -1.5rem;
8
+ margin-top: -1em;
9
9
 
10
10
  .species-filters {
11
11
  .ui.container {
@@ -1,17 +1,19 @@
1
1
  /* eslint-disable react/jsx-no-target-blank */
2
- import React from 'react';
3
- import { Container } from 'semantic-ui-react';
4
- import loadable from '@loadable/component';
5
- import { photoPlaceholders } from '@eeacms/volto-n2k/helpers';
2
+ import React, { useRef, useState } from 'react';
6
3
  import cx from 'classnames';
4
+ import loadable from '@loadable/component';
5
+ import { Icon } from '@plone/volto/components';
6
+ import arrowLeft from '@eeacms/volto-n2k/icons/arrow-left.svg';
7
+ import arrowRight from '@eeacms/volto-n2k/icons/arrow-right.svg';
7
8
  import './style.less';
8
- import 'slick-carousel/slick/slick.css';
9
- import 'slick-carousel/slick/slick-theme.css';
10
9
 
11
- const Slider = loadable(() => import('react-slick'));
10
+ const SwiperLoader = loadable.lib(() => import('swiper'));
11
+ const SwiperReactLoader = loadable.lib(() => import('swiper/react'));
12
12
 
13
13
  const View = (props) => {
14
- const slider = React.useRef(null);
14
+ const swiperEl = useRef();
15
+ const previewEl = useRef();
16
+ const [activeSlide, setActiveSlide] = useState(0);
15
17
  const provider_data = props.provider_data || {};
16
18
  const {
17
19
  author = [],
@@ -23,112 +25,170 @@ const View = (props) => {
23
25
  picture_url = [],
24
26
  scientific_name = [],
25
27
  source = [],
26
- source_url = [],
27
- species_group_name = [],
28
+ // source_url = [],
29
+ // species_group_name = [],
28
30
  } = provider_data;
29
31
 
30
- const sliderSettings = {
31
- adaptiveHeight: true,
32
- autoplay: true,
33
- autoplaySpeed: 5000,
34
- arrows: true,
35
- cssEase: 'ease',
36
- dots: false,
37
- speed: 500,
38
- initialSlide: 0,
39
- lazyLoad: 'ondemand',
40
- swipe: true,
41
- slidesToShow: 1,
42
- slidesToScroll: 1,
43
- touchMove: true,
44
- };
32
+ const pictures_length = picture_url?.length;
45
33
 
46
34
  if (!id_eunis[0]) return '';
47
35
  return (
48
- <div className="species-banner-details full-width">
49
- <Container>
50
- <div className="species-details">
51
- <div className="species-metadata">
52
- <h2 className="name">
53
- {common_name[0] ? common_name[0] + ' - ' : ''}{' '}
54
- <span style={{ fontStyle: 'italic', textTransform: 'none' }}>
55
- {scientific_name[0]}
56
- </span>
57
- </h2>
58
- {author[0] && (
59
- <p
60
- className="info radjhan-bold"
61
- style={{ marginBottom: '0.5rem' }}
36
+ <div className="species-banner-details">
37
+ <div className="species-details">
38
+ <div className="species-metadata">
39
+ <h2 className="name">
40
+ {common_name[0] ? common_name[0] + ' - ' : ''}{' '}
41
+ <span style={{ fontStyle: 'italic', textTransform: 'none' }}>
42
+ {scientific_name[0]}
43
+ </span>
44
+ </h2>
45
+ {author[0] && (
46
+ <p className="info radjhan-bold" style={{ marginBottom: '0.5rem' }}>
47
+ {author[0]}
48
+ </p>
49
+ )}
50
+ {code_2000[0] && (
51
+ <p className="info">
52
+ Natura 2000 species code&nbsp;&nbsp;&nbsp;{code_2000[0]}
53
+ <br />
54
+ <br />
55
+ <a
56
+ href={`http://images.google.com/images?q=${scientific_name[0]}`}
57
+ target="_blank"
62
58
  >
63
- {author[0]}
64
- </p>
65
- )}
66
- {code_2000[0] && (
67
- <p className="info">
68
- Natura 2000 species code&nbsp;&nbsp;&nbsp;{code_2000[0]}
69
- </p>
70
- )}
71
- {/* <br />
72
- {number_sites[0] && (
73
- <h3 style={{ marginBottom: '0.5rem' }}>{number_sites[0]}</h3>
74
- )}
75
- <h4 className="radjhan-normal">
76
- NATURA 2000 SITES PROTECTING THIS SPECIES
77
- </h4> */}
78
- </div>
59
+ Find image on the web
60
+ </a>
61
+ </p>
62
+ )}
63
+ </div>
64
+
65
+ {pictures_length > 0 && (
79
66
  <div
80
- className={cx('species-pictures', {
81
- 'with-slider': picture_url.length > 0 && picture_url[0],
67
+ className={cx('carousel', {
68
+ 'one-slide': pictures_length === 1,
69
+ 'two-slides': pictures_length === 2,
70
+ 'three-slides': pictures_length > 2,
82
71
  })}
83
72
  >
84
- {picture_url.length > 0 && picture_url[0] ? (
85
- <Slider {...sliderSettings} ref={slider}>
86
- {picture_url.map((picture, index) => (
87
- <div key={`${picture}_${index}`} className="picture-wrapper">
88
- <img src={picture} alt={common_name[0]} />
89
- <div className="source">
90
- <a
91
- href={source_url[index]}
92
- title={'Picture source'}
93
- target="_blank"
94
- rel="noreferrer"
95
- >
96
- {source[index]}
97
- {license[index] ? (
98
- <>
99
- ,<br />
100
- {license[index]}
101
- </>
102
- ) : (
103
- ''
104
- )}
105
- </a>
106
- </div>
107
- </div>
108
- ))}
109
- </Slider>
110
- ) : (
111
- <div className="picture-wrapper">
112
- <img
113
- src={
114
- photoPlaceholders[species_group_name[0]] ||
115
- photoPlaceholders.default
73
+ <div className="arrows">
74
+ <button
75
+ className="swiper-button image-swiper-button-prev"
76
+ onClick={() => {
77
+ swiperEl.current.slidePrev();
78
+ if (previewEl.current?.[0]) {
79
+ previewEl.current[0].slidePrev();
116
80
  }
117
- alt={species_group_name[0]}
81
+ if (previewEl.current?.[1]) {
82
+ previewEl.current[1].slidePrev();
83
+ }
84
+ setActiveSlide(swiperEl.current.realIndex);
85
+ }}
86
+ >
87
+ <Icon
88
+ className="icon-left"
89
+ color="#000"
90
+ name={arrowLeft}
91
+ size="32px"
118
92
  />
119
- </div>
120
- )}
121
- <div className="find-image">
122
- <a
123
- href={`http://images.google.com/images?q=${scientific_name[0]}`}
124
- target="_blank"
93
+ </button>
94
+ <button
95
+ className="swiper-button image-swiper-button-next"
96
+ onClick={() => {
97
+ swiperEl.current.slideNext();
98
+ if (previewEl.current?.[0]) {
99
+ previewEl.current[0].slideNext();
100
+ }
101
+ if (previewEl.current?.[1]) {
102
+ previewEl.current[1].slideNext();
103
+ }
104
+ setActiveSlide(swiperEl.current.realIndex);
105
+ }}
125
106
  >
126
- Find image on the web
127
- </a>
107
+ <Icon
108
+ className="icon-right"
109
+ color="#000"
110
+ name={arrowRight}
111
+ size="32px"
112
+ />
113
+ </button>
114
+ <p title={`${source[activeSlide]} - ${license[activeSlide]}`}>
115
+ {source[activeSlide]} - {license[activeSlide]}
116
+ </p>
128
117
  </div>
118
+ <SwiperLoader>
119
+ {() => {
120
+ return (
121
+ <SwiperReactLoader>
122
+ {({ Swiper, SwiperSlide }) => {
123
+ return (
124
+ <>
125
+ <Swiper
126
+ loop={true}
127
+ initialSlide={0}
128
+ slidesPerView={1}
129
+ spaceBetween={0}
130
+ onBeforeInit={(swiper) => {
131
+ swiperEl.current = swiper;
132
+ }}
133
+ >
134
+ {picture_url.map((source, index) => (
135
+ <SwiperSlide>
136
+ <img src={source} alt={picture_url[index]} />
137
+ </SwiperSlide>
138
+ ))}
139
+ </Swiper>
140
+ {pictures_length > 1 && (
141
+ <Swiper
142
+ className="preview preview-one"
143
+ loop={true}
144
+ initialSlide={1}
145
+ slidesPerView={1}
146
+ spaceBetween={0}
147
+ onBeforeInit={(swiper) => {
148
+ if (!previewEl.current) {
149
+ previewEl.current = [];
150
+ }
151
+ previewEl.current[0] = swiper;
152
+ }}
153
+ >
154
+ {picture_url.map((source, index) => (
155
+ <SwiperSlide>
156
+ <img src={source} alt={picture_url[index]} />
157
+ </SwiperSlide>
158
+ ))}
159
+ </Swiper>
160
+ )}
161
+ {pictures_length > 2 && (
162
+ <Swiper
163
+ className="preview preview-two"
164
+ loop={true}
165
+ initialSlide={2}
166
+ slidesPerView={1}
167
+ spaceBetween={0}
168
+ onBeforeInit={(swiper) => {
169
+ if (!previewEl.current) {
170
+ previewEl.current = [];
171
+ }
172
+ previewEl.current[1] = swiper;
173
+ }}
174
+ >
175
+ {picture_url.map((source, index) => (
176
+ <SwiperSlide>
177
+ <img src={source} alt={picture_url[index]} />
178
+ </SwiperSlide>
179
+ ))}
180
+ </Swiper>
181
+ )}
182
+ </>
183
+ );
184
+ }}
185
+ </SwiperReactLoader>
186
+ );
187
+ }}
188
+ </SwiperLoader>
129
189
  </div>
130
- </div>
131
- </Container>
190
+ )}
191
+ </div>
132
192
  </div>
133
193
  );
134
194
  };