@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.
Files changed (233) hide show
  1. package/.coverage.babel.config.js +9 -0
  2. package/.release-it.json +17 -0
  3. package/CHANGELOG.md +155 -0
  4. package/DEVELOP.md +53 -0
  5. package/Jenkinsfile +209 -0
  6. package/LICENSE.md +9 -0
  7. package/README.md +62 -0
  8. package/bootstrap +41 -0
  9. package/cypress/fixtures/example.json +5 -0
  10. package/cypress/integration/block-basics.js +32 -0
  11. package/cypress/plugins/index.js +26 -0
  12. package/cypress/support/commands.js +315 -0
  13. package/cypress/support/index.js +53 -0
  14. package/cypress.json +12 -0
  15. package/jest-addon.config.js +36 -0
  16. package/package.json +57 -0
  17. package/src/actions.js +20 -0
  18. package/src/components/index.js +3 -0
  19. package/src/components/manage/Blocks/BodyClass/Edit.jsx +29 -0
  20. package/src/components/manage/Blocks/BodyClass/View.jsx +13 -0
  21. package/src/components/manage/Blocks/BodyClass/index.js +24 -0
  22. package/src/components/manage/Blocks/BodyClass/schema.js +19 -0
  23. package/src/components/manage/Blocks/BubbleChart/BubbleChart.jsx +101 -0
  24. package/src/components/manage/Blocks/BubbleChart/Chart.jsx +67 -0
  25. package/src/components/manage/Blocks/BubbleChart/ChartContext.jsx +3 -0
  26. package/src/components/manage/Blocks/BubbleChart/View.jsx +63 -0
  27. package/src/components/manage/Blocks/BubbleChart/index.js +17 -0
  28. package/src/components/manage/Blocks/BubbleChart/schema.js +124 -0
  29. package/src/components/manage/Blocks/BubbleChart/style.less +12 -0
  30. package/src/components/manage/Blocks/CarouselHorizontal/HorizontalView.jsx +221 -0
  31. package/src/components/manage/Blocks/CarouselHorizontal/index.js +19 -0
  32. package/src/components/manage/Blocks/CarouselHorizontal/schema.js +32 -0
  33. package/src/components/manage/Blocks/CddaShape/View.jsx +109 -0
  34. package/src/components/manage/Blocks/CddaShape/index.js +23 -0
  35. package/src/components/manage/Blocks/CddaShape/schema.js +19 -0
  36. package/src/components/manage/Blocks/CddaShape/style.less +14 -0
  37. package/src/components/manage/Blocks/ContactBlock/View.jsx +56 -0
  38. package/src/components/manage/Blocks/ContactBlock/icons/domain.svg +1 -0
  39. package/src/components/manage/Blocks/ContactBlock/icons/email.svg +1 -0
  40. package/src/components/manage/Blocks/ContactBlock/icons/location.svg +1 -0
  41. package/src/components/manage/Blocks/ContactBlock/index.js +17 -0
  42. package/src/components/manage/Blocks/ContactBlock/schema.js +57 -0
  43. package/src/components/manage/Blocks/ContactBlock/styles.less +31 -0
  44. package/src/components/manage/Blocks/ExplodedPiesChart/Pie.jsx +125 -0
  45. package/src/components/manage/Blocks/ExplodedPiesChart/View.jsx +80 -0
  46. package/src/components/manage/Blocks/ExplodedPiesChart/index.js +17 -0
  47. package/src/components/manage/Blocks/ExplodedPiesChart/schema.js +75 -0
  48. package/src/components/manage/Blocks/ExplodedPiesChart/style.less +80 -0
  49. package/src/components/manage/Blocks/ExploreHabitats/Edit.jsx +29 -0
  50. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +177 -0
  51. package/src/components/manage/Blocks/ExploreHabitats/index.js +24 -0
  52. package/src/components/manage/Blocks/ExploreHabitats/schema.js +15 -0
  53. package/src/components/manage/Blocks/ExploreHabitats/style.less +15 -0
  54. package/src/components/manage/Blocks/ExploreSites/Edit.jsx +29 -0
  55. package/src/components/manage/Blocks/ExploreSites/View.jsx +175 -0
  56. package/src/components/manage/Blocks/ExploreSites/index.js +24 -0
  57. package/src/components/manage/Blocks/ExploreSites/schema.js +15 -0
  58. package/src/components/manage/Blocks/ExploreSites/style.less +15 -0
  59. package/src/components/manage/Blocks/ExploreSpecies/Edit.jsx +29 -0
  60. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +177 -0
  61. package/src/components/manage/Blocks/ExploreSpecies/index.js +24 -0
  62. package/src/components/manage/Blocks/ExploreSpecies/schema.js +15 -0
  63. package/src/components/manage/Blocks/ExploreSpecies/style.less +15 -0
  64. package/src/components/manage/Blocks/HabitatClassification/View.jsx +30 -0
  65. package/src/components/manage/Blocks/HabitatClassification/index.js +17 -0
  66. package/src/components/manage/Blocks/HabitatClassification/schema.js +19 -0
  67. package/src/components/manage/Blocks/HabitatClassification/style.less +3 -0
  68. package/src/components/manage/Blocks/HabitatDistribution/View.jsx +97 -0
  69. package/src/components/manage/Blocks/HabitatDistribution/index.js +23 -0
  70. package/src/components/manage/Blocks/HabitatDistribution/schema.js +19 -0
  71. package/src/components/manage/Blocks/HabitatDistribution/style.less +5 -0
  72. package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +97 -0
  73. package/src/components/manage/Blocks/HabitatProtectedSites/index.js +23 -0
  74. package/src/components/manage/Blocks/HabitatProtectedSites/schema.js +19 -0
  75. package/src/components/manage/Blocks/HabitatProtectedSites/style.less +5 -0
  76. package/src/components/manage/Blocks/HabitatsBanner/View.jsx +39 -0
  77. package/src/components/manage/Blocks/HabitatsBanner/index.js +17 -0
  78. package/src/components/manage/Blocks/HabitatsBanner/schema.js +19 -0
  79. package/src/components/manage/Blocks/HabitatsBanner/style.less +49 -0
  80. package/src/components/manage/Blocks/ImageText/Edit.jsx +98 -0
  81. package/src/components/manage/Blocks/ImageText/View.jsx +66 -0
  82. package/src/components/manage/Blocks/ImageText/index.js +24 -0
  83. package/src/components/manage/Blocks/ImageText/schema.js +69 -0
  84. package/src/components/manage/Blocks/ImageText/styles.less +87 -0
  85. package/src/components/manage/Blocks/Landing/DefalutView.jsx +83 -0
  86. package/src/components/manage/Blocks/Landing/Edit.jsx +219 -0
  87. package/src/components/manage/Blocks/Landing/EditBlockWrapper.jsx +161 -0
  88. package/src/components/manage/Blocks/Landing/View.jsx +65 -0
  89. package/src/components/manage/Blocks/Landing/images/background.webp +0 -0
  90. package/src/components/manage/Blocks/Landing/images/coasts_and_seas.webp +0 -0
  91. package/src/components/manage/Blocks/Landing/images/forests.webp +0 -0
  92. package/src/components/manage/Blocks/Landing/images/grasslands.webp +0 -0
  93. package/src/components/manage/Blocks/Landing/images/hiker.webp +0 -0
  94. package/src/components/manage/Blocks/Landing/images/islands.webp +0 -0
  95. package/src/components/manage/Blocks/Landing/images/mountains.webp +0 -0
  96. package/src/components/manage/Blocks/Landing/images/natura2000.webp +0 -0
  97. package/src/components/manage/Blocks/Landing/images/natura2000_square.webp +0 -0
  98. package/src/components/manage/Blocks/Landing/images/peatlands.webp +0 -0
  99. package/src/components/manage/Blocks/Landing/images/people_and_nature.webp +0 -0
  100. package/src/components/manage/Blocks/Landing/images/rivers.webp +0 -0
  101. package/src/components/manage/Blocks/Landing/index.js +104 -0
  102. package/src/components/manage/Blocks/Landing/schema.js +62 -0
  103. package/src/components/manage/Blocks/Landing/style.less +174 -0
  104. package/src/components/manage/Blocks/List/View.jsx +37 -0
  105. package/src/components/manage/Blocks/List/index.js +17 -0
  106. package/src/components/manage/Blocks/List/schema.js +49 -0
  107. package/src/components/manage/Blocks/List/style.less +12 -0
  108. package/src/components/manage/Blocks/NavigationAnchors/Edit.jsx +33 -0
  109. package/src/components/manage/Blocks/NavigationAnchors/View.jsx +132 -0
  110. package/src/components/manage/Blocks/NavigationAnchors/assets/external.png +0 -0
  111. package/src/components/manage/Blocks/NavigationAnchors/index.js +23 -0
  112. package/src/components/manage/Blocks/NavigationAnchors/schema.js +76 -0
  113. package/src/components/manage/Blocks/NavigationAnchors/styles.less +104 -0
  114. package/src/components/manage/Blocks/SimpleDataTable/index.js +16 -0
  115. package/src/components/manage/Blocks/SimpleDataTable/templates/colored/View.jsx +178 -0
  116. package/src/components/manage/Blocks/SimpleDataTable/templates/colored/index.js +4 -0
  117. package/src/components/manage/Blocks/SimpleDataTable/templates/colored/schema.js +56 -0
  118. package/src/components/manage/Blocks/SimpleDataTable/templates/colored/style.less +54 -0
  119. package/src/components/manage/Blocks/SiteBanner/View.jsx +148 -0
  120. package/src/components/manage/Blocks/SiteBanner/index.js +17 -0
  121. package/src/components/manage/Blocks/SiteBanner/schema.js +19 -0
  122. package/src/components/manage/Blocks/SiteBanner/style.less +106 -0
  123. package/src/components/manage/Blocks/SiteHabitatsList/View.jsx +89 -0
  124. package/src/components/manage/Blocks/SiteHabitatsList/index.js +17 -0
  125. package/src/components/manage/Blocks/SiteHabitatsList/schema.js +19 -0
  126. package/src/components/manage/Blocks/SiteHabitatsList/style.less +70 -0
  127. package/src/components/manage/Blocks/SiteProtectedHabitats/View.jsx +47 -0
  128. package/src/components/manage/Blocks/SiteProtectedHabitats/images/background.webp +0 -0
  129. package/src/components/manage/Blocks/SiteProtectedHabitats/index.js +17 -0
  130. package/src/components/manage/Blocks/SiteProtectedHabitats/schema.js +19 -0
  131. package/src/components/manage/Blocks/SiteProtectedHabitats/style.less +90 -0
  132. package/src/components/manage/Blocks/SiteProtectedSpecies/View.jsx +55 -0
  133. package/src/components/manage/Blocks/SiteProtectedSpecies/images/background.webp +0 -0
  134. package/src/components/manage/Blocks/SiteProtectedSpecies/index.js +17 -0
  135. package/src/components/manage/Blocks/SiteProtectedSpecies/schema.js +19 -0
  136. package/src/components/manage/Blocks/SiteProtectedSpecies/style.less +90 -0
  137. package/src/components/manage/Blocks/SiteShape/View.jsx +107 -0
  138. package/src/components/manage/Blocks/SiteShape/index.js +23 -0
  139. package/src/components/manage/Blocks/SiteShape/schema.js +19 -0
  140. package/src/components/manage/Blocks/SiteShape/style.less +15 -0
  141. package/src/components/manage/Blocks/SiteSpeciesList/Filters/SortBy.jsx +52 -0
  142. package/src/components/manage/Blocks/SiteSpeciesList/Filters/SpeciesGroups.jsx +43 -0
  143. package/src/components/manage/Blocks/SiteSpeciesList/Filters/View.jsx +200 -0
  144. package/src/components/manage/Blocks/SiteSpeciesList/Filters/index.js +4 -0
  145. package/src/components/manage/Blocks/SiteSpeciesList/View.jsx +253 -0
  146. package/src/components/manage/Blocks/SiteSpeciesList/index.js +17 -0
  147. package/src/components/manage/Blocks/SiteSpeciesList/schema.js +19 -0
  148. package/src/components/manage/Blocks/SiteSpeciesList/style.less +264 -0
  149. package/src/components/manage/Blocks/SiteSpeciesList/utils.js +33 -0
  150. package/src/components/manage/Blocks/SlateLink/render.jsx +77 -0
  151. package/src/components/manage/Blocks/SlateLink/styles.less +22 -0
  152. package/src/components/manage/Blocks/SlateSVG/constants.js +1 -0
  153. package/src/components/manage/Blocks/SlateSVG/extensions.js +11 -0
  154. package/src/components/manage/Blocks/SlateSVG/index.js +47 -0
  155. package/src/components/manage/Blocks/SlateSVG/render.jsx +42 -0
  156. package/src/components/manage/Blocks/SlateSVG/schema.js +12 -0
  157. package/src/components/manage/Blocks/SlateSVG/styles.less +6 -0
  158. package/src/components/manage/Blocks/SpeciesBanner/View.jsx +109 -0
  159. package/src/components/manage/Blocks/SpeciesBanner/index.js +17 -0
  160. package/src/components/manage/Blocks/SpeciesBanner/schema.js +19 -0
  161. package/src/components/manage/Blocks/SpeciesBanner/style.less +115 -0
  162. package/src/components/manage/Blocks/SpeciesClassification/View.jsx +19 -0
  163. package/src/components/manage/Blocks/SpeciesClassification/index.js +17 -0
  164. package/src/components/manage/Blocks/SpeciesClassification/schema.js +19 -0
  165. package/src/components/manage/Blocks/SpeciesClassification/style.less +3 -0
  166. package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +97 -0
  167. package/src/components/manage/Blocks/SpeciesDistribution/index.js +23 -0
  168. package/src/components/manage/Blocks/SpeciesDistribution/schema.js +19 -0
  169. package/src/components/manage/Blocks/SpeciesDistribution/style.less +5 -0
  170. package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +97 -0
  171. package/src/components/manage/Blocks/SpeciesProtectedSites/index.js +23 -0
  172. package/src/components/manage/Blocks/SpeciesProtectedSites/schema.js +19 -0
  173. package/src/components/manage/Blocks/SpeciesProtectedSites/style.less +5 -0
  174. package/src/components/manage/Blocks/StackedBarChart/Chart.jsx +127 -0
  175. package/src/components/manage/Blocks/StackedBarChart/ChartContext.jsx +3 -0
  176. package/src/components/manage/Blocks/StackedBarChart/StackedBars.jsx +116 -0
  177. package/src/components/manage/Blocks/StackedBarChart/View.jsx +64 -0
  178. package/src/components/manage/Blocks/StackedBarChart/index.js +17 -0
  179. package/src/components/manage/Blocks/StackedBarChart/schema.js +25 -0
  180. package/src/components/manage/Blocks/StackedBarChart/style.less +37 -0
  181. package/src/components/manage/Blocks/TilesImages/Edit.jsx +32 -0
  182. package/src/components/manage/Blocks/TilesImages/View.jsx +37 -0
  183. package/src/components/manage/Blocks/TilesImages/index.js +23 -0
  184. package/src/components/manage/Blocks/TilesImages/schema.js +72 -0
  185. package/src/components/manage/Blocks/TilesImages/styles.less +57 -0
  186. package/src/components/theme/AppExtras/CopyPaste/CopyPaste.jsx +176 -0
  187. package/src/components/theme/AppExtras/CopyPaste/index.js +3 -0
  188. package/src/components/theme/AppExtras/CopyPaste/style.less +18 -0
  189. package/src/components/theme/AppExtras/MultilingualRedirector/MultilingualRedirector.jsx +35 -0
  190. package/src/components/theme/AppExtras/index.js +13 -0
  191. package/src/components/theme/Footer/Footer.jsx +209 -0
  192. package/src/components/theme/Header/Header.jsx +81 -0
  193. package/src/components/theme/LanguageSelector/LanguageSelector.jsx +79 -0
  194. package/src/components/theme/LanguageSelector/styles.less +44 -0
  195. package/src/components/theme/Navigation/Navigation.jsx +453 -0
  196. package/src/components/theme/Sitemap/Sitemap.jsx +152 -0
  197. package/src/fonts/OpenSans-Bold.ttf +0 -0
  198. package/src/fonts/OpenSans-Regular.ttf +0 -0
  199. package/src/fonts/OpenSans-Semibold.ttf +0 -0
  200. package/src/fonts/Rajdhani-Bold.ttf +0 -0
  201. package/src/fonts/Rajdhani-Regular.ttf +0 -0
  202. package/src/grid.js +78 -0
  203. package/src/helpers.js +148 -0
  204. package/src/hocs/index.js +6 -0
  205. package/src/hocs/useResizeObserver.jsx +26 -0
  206. package/src/hocs/withLocalStorage.jsx +37 -0
  207. package/src/hocs/withScreenSize.jsx +43 -0
  208. package/src/icons/home.svg +12 -0
  209. package/src/icons/info.svg +5 -0
  210. package/src/icons/n2k-logo-transparent.png +0 -0
  211. package/src/icons/n2k-logo.png +0 -0
  212. package/src/icons/natura2000.svg +142 -0
  213. package/src/icons/placeholders/Algae.png +0 -0
  214. package/src/icons/placeholders/Amphibians.png +0 -0
  215. package/src/icons/placeholders/Birds.png +0 -0
  216. package/src/icons/placeholders/Conifers.png +0 -0
  217. package/src/icons/placeholders/Fishes.png +0 -0
  218. package/src/icons/placeholders/Fungi.png +0 -0
  219. package/src/icons/placeholders/Mammals.png +0 -0
  220. package/src/icons/placeholders/Plants.png +0 -0
  221. package/src/icons/placeholders/Reptiles.png +0 -0
  222. package/src/icons/placeholders/default.png +0 -0
  223. package/src/index.js +163 -0
  224. package/src/less/globals.less +3 -0
  225. package/src/less/styles.less +691 -0
  226. package/src/less/variables.less +2 -0
  227. package/src/static/cca.svg +61 -0
  228. package/src/static/ec.png +0 -0
  229. package/src/static/eea.png +0 -0
  230. package/src/static/eu.jpg +0 -0
  231. package/src/static/forest.svg +100 -0
  232. package/src/static/wise.png +0 -0
  233. package/src/store.js +24 -0
@@ -0,0 +1,148 @@
1
+ import React from 'react';
2
+ import { Grid } from 'semantic-ui-react';
3
+ import './style.less';
4
+
5
+ const isNumber = (number) => {
6
+ return typeof number === 'number' && !isNaN(number);
7
+ };
8
+
9
+ const View = (props) => {
10
+ const provider_data = props.provider_data || {};
11
+ const {
12
+ country_name,
13
+ site_name,
14
+ designation = [],
15
+ cdda_designation_national_language = [],
16
+ site_type = [],
17
+ site_code = [],
18
+ area_km2 = [],
19
+ area_ha = [],
20
+ year_stablished = [],
21
+ number_protected_habitat_types = [],
22
+ number_protected_species = [],
23
+ major_ecosystem_type = [],
24
+ } = provider_data;
25
+
26
+ if (!site_code[0]) return '';
27
+ return (
28
+ <div className="site-banner full-width">
29
+ <div className="ui container">
30
+ <Grid columns="equal">
31
+ <Grid.Column style={{ paddingBottom: 0 }} computer="12" mobile="12">
32
+ <h2 className="country-title">{site_name}</h2>
33
+ <p className="site-name">{country_name}</p>
34
+ {designation ? (
35
+ <p className="site-designation">{designation}</p>
36
+ ) : (
37
+ ''
38
+ )}
39
+ </Grid.Column>
40
+ <Grid.Column style={{ paddingTop: 0 }} computer="8" mobile="12">
41
+ <div className="site-details-wrapper">
42
+ {site_type[0] === 'CDDA' && (
43
+ <>
44
+ <div className="site-detail">
45
+ <div className="upper">
46
+ {cdda_designation_national_language[0] ? (
47
+ <div>{cdda_designation_national_language}</div>
48
+ ) : (
49
+ <div>-</div>
50
+ )}
51
+ </div>
52
+ <div className="lower">Designation (National Language)</div>
53
+ </div>
54
+
55
+ <div className="site-detail">
56
+ <div className="upper">
57
+ {designation[0] ? <div>{designation}</div> : <div>-</div>}
58
+ </div>
59
+ <div className="lower">Designation (English)</div>
60
+ </div>
61
+ </>
62
+ )}
63
+
64
+ <div className="site-detail">
65
+ <div className="upper">
66
+ {site_code[0] ? <div>{site_code}</div> : <div>-</div>}
67
+ </div>
68
+ <div className="lower">Site code</div>
69
+ </div>
70
+
71
+ <div className="site-detail">
72
+ <div className="upper">
73
+ {isNumber(area_km2[0]) || isNumber(area_ha[0]) ? (
74
+ area_km2 > 1 ? (
75
+ <div>
76
+ {area_km2} km<sup>2</sup>
77
+ </div>
78
+ ) : (
79
+ <div>{area_ha} ha</div>
80
+ )
81
+ ) : (
82
+ <div>No data</div>
83
+ )}
84
+ </div>
85
+ <div className="lower">Reported area</div>
86
+ </div>
87
+
88
+ <div className="site-detail">
89
+ <div className="upper">
90
+ {year_stablished[0] ? (
91
+ <div>{year_stablished}</div>
92
+ ) : (
93
+ <div>-</div>
94
+ )}
95
+ </div>
96
+ <div className="lower">Year established</div>
97
+ </div>
98
+
99
+ {site_type[0] === 'CDDA' && (
100
+ <div className="site-detail">
101
+ <div className="upper">
102
+ {major_ecosystem_type[0] ? (
103
+ <div>{major_ecosystem_type}</div>
104
+ ) : (
105
+ <div>-</div>
106
+ )}
107
+ </div>
108
+ <div className="lower">Ecosystem</div>
109
+ </div>
110
+ )}
111
+
112
+ {site_type[0] === 'Natura2000' && (
113
+ <>
114
+ <div className="site-detail">
115
+ <div className="upper">
116
+ {isNumber(number_protected_habitat_types[0]) ? (
117
+ <div>{number_protected_habitat_types}</div>
118
+ ) : (
119
+ <div>No data</div>
120
+ )}
121
+ </div>
122
+ <div className="lower">EU Protected habitats</div>
123
+ </div>
124
+
125
+ <div className="site-detail">
126
+ <div className="upper">
127
+ {isNumber(number_protected_species[0]) ? (
128
+ <div>{number_protected_species}</div>
129
+ ) : (
130
+ <div>No data</div>
131
+ )}
132
+ </div>
133
+ <div className="lower">EU Protected species</div>
134
+ </div>
135
+ </>
136
+ )}
137
+ </div>
138
+ </Grid.Column>
139
+ <Grid.Column computer="4" mobile="12">
140
+ {/*map svg here*/}
141
+ </Grid.Column>
142
+ </Grid>
143
+ </div>
144
+ </div>
145
+ );
146
+ };
147
+
148
+ export default View;
@@ -0,0 +1,17 @@
1
+ import SiteBannerView from './View';
2
+ import getSchema from './schema';
3
+
4
+ export default (config) => {
5
+ config.blocks.blocksConfig.custom_connected_block = {
6
+ ...config.blocks.blocksConfig.custom_connected_block,
7
+ blocks: {
8
+ ...config.blocks.blocksConfig.custom_connected_block.blocks,
9
+ site_banner: {
10
+ view: SiteBannerView,
11
+ getSchema: getSchema,
12
+ title: 'Site banner',
13
+ },
14
+ },
15
+ };
16
+ return config;
17
+ };
@@ -0,0 +1,19 @@
1
+ const getSchema = (props) => {
2
+ return {
3
+ title: 'Site banner',
4
+
5
+ fieldsets: [
6
+ {
7
+ id: 'default',
8
+ title: 'Default',
9
+ fields: [],
10
+ },
11
+ ],
12
+
13
+ properties: {},
14
+
15
+ required: [],
16
+ };
17
+ };
18
+
19
+ export default getSchema;
@@ -0,0 +1,106 @@
1
+ .site-banner {
2
+ padding: 1.5em 0;
3
+ background-color: #04a77d;
4
+ color: #fff;
5
+ font-family: 'RajdhaniB';
6
+
7
+ .ui.container > * {
8
+ margin-bottom: 0 !important;
9
+ }
10
+
11
+ .block .ui.image {
12
+ width: auto;
13
+ }
14
+
15
+ .country-title {
16
+ margin-top: 0.5em !important;
17
+ margin-bottom: 0 !important;
18
+ color: #fff;
19
+ font-family: inherit;
20
+ font-size: 54px;
21
+ line-height: 54px;
22
+ text-transform: uppercase;
23
+ }
24
+
25
+ .site-name {
26
+ display: flex;
27
+ align-items: center;
28
+ margin-bottom: 0.5rem;
29
+ font-family: 'RajdhaniR';
30
+ font-size: 18px;
31
+ font-weight: 600;
32
+ line-height: 18px;
33
+
34
+ .info-icon {
35
+ display: flex;
36
+ align-items: center;
37
+ margin-left: 15px;
38
+ filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.4));
39
+
40
+ &:hover {
41
+ .description {
42
+ max-width: 300px;
43
+ transition: max-width 0.4s;
44
+ }
45
+ }
46
+
47
+ svg {
48
+ z-index: 1;
49
+ }
50
+
51
+ .description {
52
+ z-index: 0;
53
+ overflow: hidden;
54
+ width: auto;
55
+ max-width: 0;
56
+ margin-left: -1rem;
57
+ color: #eb9700;
58
+ font-family: 'RajdhaniR';
59
+ font-size: 14px;
60
+ line-height: 14px;
61
+ transition: max-width 0.3s;
62
+
63
+ span {
64
+ display: inline-block;
65
+ padding: 4px 1rem 4px 1.5rem;
66
+ border: 1px solid #707070;
67
+ background: #fff;
68
+ border-radius: 10px;
69
+ white-space: nowrap;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ .site-designation {
76
+ font-family: 'RajdhaniR';
77
+ font-size: 18px;
78
+ font-weight: 400;
79
+ line-height: 18px;
80
+ }
81
+
82
+ .site-details-wrapper {
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ }
86
+
87
+ .site-detail {
88
+ flex: 0 1 30%;
89
+ padding-right: 1em;
90
+ margin-top: 3em;
91
+
92
+ .upper {
93
+ margin-bottom: 0.2em;
94
+ font-size: 39px;
95
+ font-weight: 700;
96
+ line-height: 1;
97
+ }
98
+
99
+ .lower {
100
+ font-size: 14px;
101
+ font-weight: 700;
102
+ line-height: 1;
103
+ text-transform: uppercase;
104
+ }
105
+ }
106
+ }
@@ -0,0 +1,89 @@
1
+ import React from 'react';
2
+ import { Icon } from '@plone/volto/components';
3
+ import { Link } from 'react-router-dom';
4
+ import cx from 'classnames';
5
+ import { getObjectByIndex } from '@eeacms/volto-n2k/helpers';
6
+ import downKeySVG from '@plone/volto/icons/down-key.svg';
7
+ import upKeySVG from '@plone/volto/icons/up-key.svg';
8
+ import './style.less';
9
+
10
+ const View = (props) => {
11
+ const [habitats, setHabitats] = React.useState({});
12
+ const [selectedHabitat, setSelectedHabitat] = React.useState(null);
13
+ const { provider_data = {}, placeholder = 'No results' } = props;
14
+
15
+ React.useEffect(() => {
16
+ const newHabitats = {};
17
+ if (provider_data?.habitat_group?.length) {
18
+ provider_data.habitat_group.forEach((habitat, index) => {
19
+ if (!newHabitats[habitat]) {
20
+ newHabitats[habitat] = [];
21
+ }
22
+ newHabitats[habitat].push(getObjectByIndex(provider_data, index));
23
+ });
24
+ }
25
+ setHabitats(newHabitats);
26
+ /* eslint-disable-next-line */
27
+ }, [JSON.stringify(provider_data)]);
28
+
29
+ return (
30
+ <div className="site-habitats-list">
31
+ {Object.keys(habitats)?.length ? (
32
+ Object.keys(habitats)
33
+ .sort()
34
+ .map((habitat) => (
35
+ <div className="habitat" key={habitat}>
36
+ <div
37
+ className={cx({
38
+ 'habitat-toolbar': true,
39
+ marginless: selectedHabitat !== habitat,
40
+ })}
41
+ >
42
+ <div className="habitat-name">
43
+ <h3>{habitat}</h3>
44
+ <p className="count">{habitats[habitat].length}</p>
45
+ </div>
46
+ <Icon
47
+ name={selectedHabitat === habitat ? upKeySVG : downKeySVG}
48
+ onClick={(e) => {
49
+ setSelectedHabitat(
50
+ selectedHabitat === habitat ? null : habitat,
51
+ );
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ }}
55
+ color="#8C8C8C"
56
+ size="32px"
57
+ />
58
+ </div>
59
+
60
+ {selectedHabitat === habitat
61
+ ? habitats[habitat].map((item, index) => (
62
+ <div
63
+ className="habitat-item"
64
+ key={`${habitat}-${index}-item`}
65
+ >
66
+ <Link
67
+ className="description"
68
+ to={`/natura2000/habitats/h/${item.code_2000}`}
69
+ >
70
+ {item.habitat_description}
71
+ </Link>
72
+ <p className="coverage">
73
+ {item.coverage_ha.toFixed(2)} ha (
74
+ {(item.coverage_ha / 100).toFixed(4)} km
75
+ <sup>2</sup>)
76
+ </p>
77
+ </div>
78
+ ))
79
+ : ''}
80
+ </div>
81
+ ))
82
+ ) : (
83
+ <p>{placeholder}</p>
84
+ )}
85
+ </div>
86
+ );
87
+ };
88
+
89
+ export default View;
@@ -0,0 +1,17 @@
1
+ import SiteHabitatsList from './View';
2
+ import getSchema from './schema';
3
+
4
+ export default (config) => {
5
+ config.blocks.blocksConfig.custom_connected_block = {
6
+ ...config.blocks.blocksConfig.custom_connected_block,
7
+ blocks: {
8
+ ...config.blocks.blocksConfig.custom_connected_block.blocks,
9
+ site_habitats_list: {
10
+ view: SiteHabitatsList,
11
+ getSchema: getSchema,
12
+ title: 'Site habitats list',
13
+ },
14
+ },
15
+ };
16
+ return config;
17
+ };
@@ -0,0 +1,19 @@
1
+ const getSchema = (props) => {
2
+ return {
3
+ title: 'Site habitats list',
4
+
5
+ fieldsets: [
6
+ {
7
+ id: 'default',
8
+ title: 'Default',
9
+ fields: [],
10
+ },
11
+ ],
12
+
13
+ properties: {},
14
+
15
+ required: [],
16
+ };
17
+ };
18
+
19
+ export default getSchema;
@@ -0,0 +1,70 @@
1
+ .site-habitats-list {
2
+ .icon {
3
+ cursor: pointer;
4
+ }
5
+
6
+ .habitat {
7
+ padding: 1rem 2rem;
8
+ border: 1px solid #e8e8e8;
9
+ margin-bottom: 1rem;
10
+ background-color: #fff;
11
+ border-radius: 10px;
12
+
13
+ .habitat-toolbar {
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ margin-bottom: 1rem;
18
+
19
+ &.marginless {
20
+ margin-bottom: 0;
21
+ }
22
+ }
23
+
24
+ .habitat-name {
25
+ display: flex;
26
+ align-items: center;
27
+
28
+ h3 {
29
+ margin-right: 1rem;
30
+ margin-bottom: 0;
31
+ color: #013c60;
32
+ font-weight: 400;
33
+ line-height: 25px;
34
+ }
35
+
36
+ .count {
37
+ width: 24px;
38
+ height: 24px;
39
+ margin-bottom: 0;
40
+ background-color: #04a87d;
41
+ border-radius: 6px;
42
+ color: #fff;
43
+ font-weight: bold;
44
+ line-height: 24px;
45
+ text-align: center;
46
+ }
47
+ }
48
+
49
+ .habitat-item {
50
+ .description {
51
+ color: #013c60;
52
+ font-size: 1.2rem;
53
+ font-weight: 400;
54
+
55
+ &:hover {
56
+ opacity: 0.9;
57
+ }
58
+ }
59
+
60
+ .coverage {
61
+ color: #8c8c8c;
62
+ }
63
+
64
+ p {
65
+ margin-bottom: 0;
66
+ }
67
+ margin-bottom: 1rem;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { Container } from 'semantic-ui-react';
3
+ import { getObjectByIndex } from '@eeacms/volto-n2k/helpers';
4
+
5
+ import './style.less';
6
+
7
+ const View = (props) => {
8
+ const [habitats, setHabitats] = React.useState({});
9
+ const provider_data = props.provider_data || {};
10
+
11
+ React.useEffect(() => {
12
+ const newHabitats = {};
13
+ if (provider_data?.habitat_group?.length) {
14
+ provider_data.habitat_group.forEach((habitat, index) => {
15
+ if (!newHabitats[habitat]) {
16
+ newHabitats[habitat] = [];
17
+ }
18
+ newHabitats[habitat].push(getObjectByIndex(provider_data, index));
19
+ });
20
+ }
21
+ setHabitats(newHabitats);
22
+ /* eslint-disable-next-line */
23
+ }, [JSON.stringify(provider_data)]);
24
+
25
+ return (
26
+ <div className="habitats-banner full-width">
27
+ <div className="habitats-container">
28
+ <Container className="habitats-wrapper">
29
+ <div className="habitats-wrapper">
30
+ {Object.entries(habitats).map(([habitat, items], index) => (
31
+ <div key={index} className="habitat-box">
32
+ <div className="upper">
33
+ <span>{items.length}</span>
34
+ </div>
35
+ <div className="lower">
36
+ <span>{habitat}</span>
37
+ </div>
38
+ </div>
39
+ ))}
40
+ </div>
41
+ </Container>
42
+ </div>
43
+ </div>
44
+ );
45
+ };
46
+
47
+ export default View;
@@ -0,0 +1,17 @@
1
+ import SiteProtectedHabitatsView from './View';
2
+ import getSchema from './schema';
3
+
4
+ export default (config) => {
5
+ config.blocks.blocksConfig.custom_connected_block = {
6
+ ...config.blocks.blocksConfig.custom_connected_block,
7
+ blocks: {
8
+ ...config.blocks.blocksConfig.custom_connected_block.blocks,
9
+ site_protected_habitats: {
10
+ view: SiteProtectedHabitatsView,
11
+ getSchema: getSchema,
12
+ title: 'Site protected habitats',
13
+ },
14
+ },
15
+ };
16
+ return config;
17
+ };
@@ -0,0 +1,19 @@
1
+ const getSchema = (props) => {
2
+ return {
3
+ title: 'Site protected habitats',
4
+
5
+ fieldsets: [
6
+ {
7
+ id: 'default',
8
+ title: 'Default',
9
+ fields: [],
10
+ },
11
+ ],
12
+
13
+ properties: {},
14
+
15
+ required: [],
16
+ };
17
+ };
18
+
19
+ export default getSchema;
@@ -0,0 +1,90 @@
1
+ @import (multiple, reference, optional) '../../theme.config';
2
+ @type: extra;
3
+ @element: custom;
4
+
5
+ div#view .ui.container.habitats-wrapper > * {
6
+ margin-bottom: 0;
7
+ }
8
+
9
+ .habitats-banner {
10
+ position: relative;
11
+ height: 320px;
12
+ background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.7)),
13
+ url('./images/background.webp');
14
+ background-position: center;
15
+ background-repeat: no-repeat;
16
+ background-size: cover;
17
+ font-family: 'RajdhaniB';
18
+
19
+ .habitats-container {
20
+ position: absolute;
21
+ top: 50%;
22
+ left: 50%;
23
+ width: 100%;
24
+ transform: translate(-50%, -50%);
25
+ }
26
+
27
+ .habitats-wrapper {
28
+ display: flex;
29
+ flex-flow: row;
30
+ margin: 0 auto !important;
31
+ overflow-x: auto;
32
+ }
33
+
34
+ .habitats-wrapper:before,
35
+ .habitats-wrapper:after {
36
+ flex: 1;
37
+ content: '';
38
+ }
39
+
40
+ .habitat-box {
41
+ margin: 0.5em 1.5em;
42
+
43
+ .upper {
44
+ position: relative;
45
+ width: 110px;
46
+ height: 110px;
47
+ margin: auto;
48
+ background-color: #eaeaea;
49
+ border-radius: 50%;
50
+
51
+ > span {
52
+ position: absolute;
53
+ top: 50%;
54
+ left: 50%;
55
+ color: #013c60;
56
+ font-family: inherit;
57
+ font-size: 55px;
58
+ transform: translate(-50%, -50%);
59
+ }
60
+ }
61
+
62
+ .lower {
63
+ margin-top: 1em;
64
+ text-align: center;
65
+
66
+ span {
67
+ color: #fff;
68
+ font-family: inherit;
69
+ font-size: 19px;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ @media only screen and (max-width: @largeMonitorBreakpoint) {
76
+ .habitats-banner {
77
+ .habitat-box {
78
+ width: 100px;
79
+
80
+ .upper {
81
+ width: 80px;
82
+ height: 80px;
83
+
84
+ span {
85
+ font-size: 40px;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }