@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,49 @@
1
+ div#view .habitat-banner-details .ui.container > * {
2
+ margin-bottom: 0;
3
+ }
4
+
5
+ .habitat-banner-details {
6
+ padding: 1.5em 0;
7
+ background-color: #04a77d;
8
+ color: #fff;
9
+ font-family: 'RajdhaniB';
10
+
11
+ .habitat-details {
12
+ display: flex;
13
+ align-items: flex-start;
14
+ justify-content: space-between;
15
+
16
+ @media only screen and (max-width: 765px) {
17
+ flex-flow: column;
18
+
19
+ .habitat-metadata {
20
+ margin-bottom: 1rem;
21
+ }
22
+ }
23
+
24
+ .habitat-metadata {
25
+ .name {
26
+ margin-top: 0.5em !important;
27
+ margin-bottom: 0 !important;
28
+ color: #fff;
29
+ font-family: inherit;
30
+ font-size: 54px;
31
+ line-height: 54px;
32
+ text-transform: uppercase;
33
+ }
34
+
35
+ .info {
36
+ font-family: 'RajdhaniR';
37
+ font-size: 18px;
38
+ font-weight: 600;
39
+ line-height: 18px;
40
+ }
41
+ }
42
+
43
+ img {
44
+ max-height: 200px;
45
+ border-radius: 10px;
46
+ filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.4));
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import config from '@plone/volto/registry';
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
5
+ import SlateEditor from 'volto-slate/editor/SlateEditor';
6
+ import { Editor } from 'volto-slate/utils';
7
+ import getSchema from './schema';
8
+ import cx from 'classnames';
9
+ import './styles.less';
10
+
11
+ const createParagraph = (text) => {
12
+ return {
13
+ children: [{ text }],
14
+ };
15
+ };
16
+
17
+ const Edit = (props) => {
18
+ const { data = {}, selected = false } = props;
19
+ const schema = getSchema();
20
+ const value = { children: data.value || [], isVoid: Editor.isVoid };
21
+ const valueUndefined =
22
+ !value.children.length || Editor.string(value, []) === '';
23
+
24
+ const handleKeyDown = (e, index, { disableEnter = false } = {}) => {
25
+ if (e.key === 'Enter' && !e.shiftKey && !disableEnter) {
26
+ props.onAddBlock(config.settings.defaultBlockType, index + 1);
27
+ e.preventDefault();
28
+ }
29
+ };
30
+
31
+ return (
32
+ <div
33
+ className={cx('image-text edit', data.theme || 'light')}
34
+ role="presentation"
35
+ onKeyDown={(e) => {
36
+ handleKeyDown(e, props.index);
37
+ }}
38
+ // The tabIndex is required for the keyboard navigation
39
+ /* eslint-disable jsx-a11y/no-noninteractive-tabindex */
40
+ tabIndex={-1}
41
+ >
42
+ {data.image ? (
43
+ <p
44
+ className={cx('p-image', {
45
+ 'with-border': data.hasBorder ?? true,
46
+ 'rounded-border': data.rounded ?? true,
47
+ })}
48
+ >
49
+ <img
50
+ src={`${data.image}/@@images/image`}
51
+ alt={data.imageTitle}
52
+ style={
53
+ data.imageSize
54
+ ? {
55
+ width: `${data.imageSize}px`,
56
+ height: `${data.imageSize}px`,
57
+ }
58
+ : {}
59
+ }
60
+ />
61
+ </p>
62
+ ) : (
63
+ ''
64
+ )}
65
+ <SlateEditor
66
+ id={`image-text-${props.id}`}
67
+ name={`image-text-${props.id}`}
68
+ value={valueUndefined ? [createParagraph('')] : value.children}
69
+ onChange={(value) => {
70
+ props.onChangeBlock(props.block, {
71
+ ...data,
72
+ value,
73
+ });
74
+ }}
75
+ block={null}
76
+ renderExtensions={[]}
77
+ selected={true}
78
+ properties={props.metadata}
79
+ placeholder="Enter some rich text..."
80
+ />
81
+ <SidebarPortal selected={selected}>
82
+ <InlineForm
83
+ schema={schema}
84
+ title={schema.title}
85
+ onChangeField={(id, value) => {
86
+ props.onChangeBlock(props.block, {
87
+ ...props.data,
88
+ [id]: value,
89
+ });
90
+ }}
91
+ formData={props.data}
92
+ />
93
+ </SidebarPortal>
94
+ </div>
95
+ );
96
+ };
97
+
98
+ export default Edit;
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { UniversalLink } from '@plone/volto/components';
3
+ import { serializeNodes } from 'volto-slate/editor/render';
4
+ import { Editor } from 'volto-slate/utils';
5
+ import cx from 'classnames';
6
+ import './styles.less';
7
+
8
+ const View = (props) => {
9
+ const { data = {} } = props;
10
+ const value = { children: data.value || [], isVoid: Editor.isVoid };
11
+ const valueUndefined =
12
+ !value.children.length || Editor.string(value, []) === '';
13
+
14
+ const ImageText = () => {
15
+ return (
16
+ <>
17
+ {data.image ? (
18
+ <p
19
+ className={cx('p-image', {
20
+ 'with-border': data.hasBorder ?? true,
21
+ 'rounded-border': data.rounded ?? true,
22
+ })}
23
+ >
24
+ <img
25
+ src={`${data.image}/@@images/image/mini`}
26
+ alt={data.imageTitle}
27
+ style={
28
+ data.imageSize
29
+ ? {
30
+ width: `${data.imageSize}px`,
31
+ height: `${data.imageSize}px`,
32
+ }
33
+ : {}
34
+ }
35
+ />
36
+ </p>
37
+ ) : (
38
+ ''
39
+ )}
40
+
41
+ {!valueUndefined ? (
42
+ <div className="text-wrapper">{serializeNodes(value.children)}</div>
43
+ ) : (
44
+ ''
45
+ )}
46
+ </>
47
+ );
48
+ };
49
+
50
+ return data.href ? (
51
+ <UniversalLink
52
+ className={cx('image-text view', data.theme || 'light')}
53
+ href={data.href || '/'}
54
+ openLinkInNewTab={data.target === '_blank'}
55
+ title={data.linkTitle}
56
+ >
57
+ <ImageText />
58
+ </UniversalLink>
59
+ ) : (
60
+ <div className={cx('image-text view', data.theme || 'light')}>
61
+ <ImageText />
62
+ </div>
63
+ );
64
+ };
65
+
66
+ export default View;
@@ -0,0 +1,24 @@
1
+ import ImageTextEdit from './Edit';
2
+ import ImageTextView from './View';
3
+ import worldSVG from '@plone/volto/icons/world.svg';
4
+
5
+ export default (config) => {
6
+ config.blocks.blocksConfig.image_text = {
7
+ id: 'image_text',
8
+ title: 'Image text',
9
+ icon: worldSVG,
10
+ group: 'natura_2000',
11
+ edit: ImageTextEdit,
12
+ view: ImageTextView,
13
+ restricted: false,
14
+ mostUsed: false,
15
+ sidebarTab: 1,
16
+ blockHasOwnFocusManagement: true,
17
+ blocks: {},
18
+ security: {
19
+ addPermission: [],
20
+ view: [],
21
+ },
22
+ };
23
+ return config;
24
+ };
@@ -0,0 +1,69 @@
1
+ export default () => ({
2
+ title: 'Image text',
3
+ fieldsets: [
4
+ {
5
+ id: 'default',
6
+ title: 'Default',
7
+ fields: ['theme', 'hasBorder', 'rounded'],
8
+ },
9
+ {
10
+ id: 'image',
11
+ title: 'Image',
12
+ fields: ['image', 'imageSize', 'imageTitle'],
13
+ },
14
+ {
15
+ id: 'link',
16
+ title: 'Link',
17
+ fields: ['linkTitle', 'href', 'target'],
18
+ },
19
+ ],
20
+ properties: {
21
+ theme: {
22
+ title: 'Theme',
23
+ type: 'array',
24
+ choices: [
25
+ ['light', 'Light'],
26
+ ['grey', 'Grey'],
27
+ ['dark', 'Dark'],
28
+ ],
29
+ default: 'light',
30
+ },
31
+ hasBorder: {
32
+ title: 'With border',
33
+ type: 'boolean',
34
+ default: true,
35
+ },
36
+ rounded: {
37
+ title: 'Rounded',
38
+ type: 'boolean',
39
+ default: true,
40
+ },
41
+ image: {
42
+ title: 'Image',
43
+ widget: 'object_by_path',
44
+ },
45
+ imageSize: {
46
+ title: 'Size',
47
+ type: 'number',
48
+ },
49
+ imageTitle: {
50
+ title: 'Title',
51
+ },
52
+ linkTitle: {
53
+ title: 'Title',
54
+ },
55
+ href: {
56
+ title: 'Url',
57
+ widget: 'textarea',
58
+ },
59
+ target: {
60
+ title: 'Target',
61
+ choices: [
62
+ ['_blank', 'New tab'],
63
+ ['_self', 'Same tab'],
64
+ ],
65
+ defaultValue: '_self',
66
+ },
67
+ },
68
+ required: [],
69
+ });
@@ -0,0 +1,87 @@
1
+ a.image-text:hover {
2
+ opacity: 0.9;
3
+ }
4
+
5
+ .image-text {
6
+ display: flex;
7
+ flex-flow: row;
8
+ align-items: center;
9
+ margin-bottom: 1rem;
10
+
11
+ .slate-editor {
12
+ width: 100%;
13
+ }
14
+
15
+ &.light {
16
+ .p-image.with-border img {
17
+ border: 1px solid #fff;
18
+ }
19
+
20
+ h1,
21
+ h2,
22
+ h3,
23
+ h4,
24
+ p,
25
+ span {
26
+ color: #fff;
27
+ }
28
+ }
29
+
30
+ &.grey {
31
+ .p-image.with-border img {
32
+ border: 1px solid #c9c9c9;
33
+ }
34
+
35
+ h1,
36
+ h2,
37
+ h3,
38
+ h4,
39
+ p,
40
+ span {
41
+ color: #c9c9c9;
42
+ }
43
+ }
44
+
45
+ &.dark {
46
+ .p-image.with-border img {
47
+ border: 1px solid #000;
48
+ }
49
+
50
+ h1,
51
+ h2,
52
+ h3,
53
+ h4,
54
+ p,
55
+ span {
56
+ color: #000;
57
+ }
58
+ }
59
+
60
+ .p-image {
61
+ margin-bottom: 0 !important;
62
+
63
+ a {
64
+ display: block;
65
+ }
66
+
67
+ img {
68
+ width: 130px;
69
+ height: 130px;
70
+ padding: 6px;
71
+ margin-right: 1rem;
72
+ margin-bottom: 0;
73
+ }
74
+ }
75
+
76
+ .p-image.rounded-border {
77
+ border-radius: 50%;
78
+
79
+ img {
80
+ border-radius: 50%;
81
+ }
82
+ }
83
+
84
+ .p-image.with-border {
85
+ margin: 0 0.5rem;
86
+ }
87
+ }
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { generatePath } from 'react-router';
4
+ import { Grid } from 'semantic-ui-react';
5
+ import { UniversalLink } from '@plone/volto/components';
6
+ import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
7
+ import hiker from './images/hiker.webp';
8
+ import { tiles, tileProps, getStyle } from './index';
9
+
10
+ const DefaultView = (props) => {
11
+ const currentLang = props.localStorage.get('N2K_LANGUAGE');
12
+
13
+ return (
14
+ <>
15
+ <div
16
+ className="landing-page-wrapper default full-width"
17
+ style={getStyle(props)}
18
+ >
19
+ <Grid className="landing-page" container columns="12">
20
+ <Grid.Row>
21
+ <Grid.Column
22
+ className="landing-page-description"
23
+ widescreen="6"
24
+ largeScreen="6"
25
+ computer="6"
26
+ tablet="12"
27
+ mobile="12"
28
+ >
29
+ <p>
30
+ DISCOVER EUROPE'S NATURE WITH ITS STUNNING DIVERSITY OF WILD
31
+ PLANTS, ANIMALS AND LANDSCAPES, MANY OF WHICH ARE FOUND NOWHERE
32
+ ELSE IN THE WORLD.
33
+ </p>
34
+ <p>
35
+ WELCOME TO <strong>NATURA 2000</strong>, THE EUROPEAN NETWORK OF
36
+ PROTECTED NATURAL AREAS.
37
+ </p>
38
+ </Grid.Column>
39
+ <Grid.Column
40
+ className="landing-page-tiles"
41
+ widescreen="6"
42
+ largeScreen="6"
43
+ computer="6"
44
+ tablet="5"
45
+ mobile="7"
46
+ >
47
+ <Grid style={{ justifyContent: 'space-around' }}>
48
+ {currentLang
49
+ ? tiles.map((item, index) => {
50
+ const link = generatePath(item.link, {
51
+ lang: currentLang,
52
+ });
53
+ return (
54
+ <Grid.Column
55
+ key={`item-${index}`}
56
+ className="item"
57
+ {...tileProps}
58
+ >
59
+ <UniversalLink href={link || '#'} title={item.title}>
60
+ <img
61
+ className="image"
62
+ src={item.image}
63
+ alt={item.title}
64
+ />
65
+ <p className="description">{item.description}</p>
66
+ </UniversalLink>
67
+ </Grid.Column>
68
+ );
69
+ })
70
+ : ''}
71
+ </Grid>
72
+ </Grid.Column>
73
+ </Grid.Row>
74
+ </Grid>
75
+ <img className="slick-image" src={hiker} alt="Hiker" />
76
+ </div>
77
+ </>
78
+ );
79
+ };
80
+
81
+ export default connect((state) => ({
82
+ screen: state.screen,
83
+ }))(withLocalStorage(DefaultView));
@@ -0,0 +1,219 @@
1
+ import React from 'react';
2
+ import { Grid, Button } from 'semantic-ui-react';
3
+ import { isEmpty } from 'lodash';
4
+ import EditBlockWrapper from './EditBlockWrapper';
5
+ import { BlocksForm, Icon } from '@plone/volto/components';
6
+ import { emptyBlocksForm } from '@plone/volto/helpers';
7
+ import { SidebarPortal, UniversalLink } from '@plone/volto/components';
8
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
9
+ import config from '@plone/volto/registry';
10
+ import settingsSVG from '@plone/volto/icons/settings.svg';
11
+ import DefaultView from './DefalutView';
12
+ import getSchema from './schema';
13
+ import hiker from './images/hiker.webp';
14
+ import { tileProps, getStyle } from './index';
15
+ import './style.less';
16
+
17
+ const Edit = (props) => {
18
+ const schema = getSchema();
19
+ const blocksState = React.useRef({});
20
+ const [activeBlock, setActiveBlock] = React.useState(null);
21
+ const {
22
+ block = null,
23
+ data = {},
24
+ manage = false,
25
+ selected = false,
26
+ onChangeBlock = () => {},
27
+ } = props;
28
+ const { useDefault = true, tiles = [] } = data;
29
+ const metadata = props.metadata || props.properties;
30
+ const blocksData = data?.data || emptyBlocksForm();
31
+
32
+ React.useEffect(() => {
33
+ if (isEmpty(data?.data)) {
34
+ onChangeBlock(block, {
35
+ ...data,
36
+ data: {
37
+ ...blocksData,
38
+ },
39
+ });
40
+ }
41
+ /* eslint-disable-next-line */
42
+ }, []);
43
+
44
+ const handleKeyDown = (
45
+ e,
46
+ index,
47
+ block,
48
+ node,
49
+ {
50
+ disableEnter = false,
51
+ disableArrowUp = false,
52
+ disableArrowDown = false,
53
+ } = {},
54
+ ) => {
55
+ if (e.key === 'ArrowUp' && !disableArrowUp && !activeBlock) {
56
+ props.onFocusPreviousBlock(block, node);
57
+ e.preventDefault();
58
+ }
59
+ if (e.key === 'ArrowDown' && !disableArrowDown && !activeBlock) {
60
+ props.onFocusNextBlock(block, node);
61
+ e.preventDefault();
62
+ }
63
+ if (e.key === 'Enter' && !disableEnter && !activeBlock) {
64
+ props.onAddBlock(config.settings.defaultBlockType, index + 1);
65
+ e.preventDefault();
66
+ }
67
+ };
68
+
69
+ const onChangeField = (id, value) => {
70
+ // special handling of blocks and blocks_layout
71
+ if (['blocks', 'blocks_layout'].indexOf(id) > -1) {
72
+ blocksState.current[id] = value;
73
+ onChangeBlock(block, {
74
+ ...data,
75
+ data: {
76
+ ...(data?.data || {}),
77
+ ...blocksState.current,
78
+ },
79
+ });
80
+ }
81
+ };
82
+
83
+ return (
84
+ <>
85
+ {useDefault ? (
86
+ <DefaultView {...props} />
87
+ ) : (
88
+ <div
89
+ className="landing-page-wrapper full-width edit"
90
+ style={getStyle(props)}
91
+ role="presentation"
92
+ onKeyDown={(e) => {
93
+ handleKeyDown(e, props.index, props.block, props.blockNode.current);
94
+ }}
95
+ // The tabIndex is required for the keyboard navigation
96
+ /* eslint-disable jsx-a11y/no-noninteractive-tabindex */
97
+ tabIndex={-1}
98
+ >
99
+ <Grid className="landing-page" container columns="12">
100
+ <Grid.Row>
101
+ <Grid.Column
102
+ className="landing-page-description"
103
+ widescreen="6"
104
+ largeScreen="6"
105
+ computer="6"
106
+ tablet="12"
107
+ mobile="12"
108
+ >
109
+ <BlocksForm
110
+ allowedBlocks={data?.allowedBlocks}
111
+ description={data?.instrunctions?.data}
112
+ manage={manage}
113
+ metadata={metadata}
114
+ pathname={props.pathname}
115
+ properties={blocksData}
116
+ selected={selected}
117
+ selectedBlock={selected && activeBlock ? activeBlock : null}
118
+ title={data?.placeholder}
119
+ onChangeField={onChangeField}
120
+ onChangeFormData={(newFormData) => {
121
+ onChangeBlock(block, {
122
+ ...data,
123
+ data: {
124
+ ...(data?.data || {}),
125
+ ...(newFormData.blocks_layout.items.length > 0
126
+ ? newFormData
127
+ : emptyBlocksForm()),
128
+ },
129
+ });
130
+ }}
131
+ onSelectBlock={(id) => {
132
+ if (activeBlock !== id) {
133
+ setActiveBlock(id);
134
+ }
135
+ }}
136
+ >
137
+ {({ draginfo }, editBlock, blockProps) => {
138
+ return (
139
+ <EditBlockWrapper
140
+ blockProps={blockProps}
141
+ draginfo={draginfo}
142
+ extraControls={
143
+ <>
144
+ <>
145
+ <Button
146
+ icon
147
+ basic
148
+ title="Settings"
149
+ onClick={() => {
150
+ setActiveBlock(null);
151
+ }}
152
+ >
153
+ <Icon
154
+ name={settingsSVG}
155
+ className=""
156
+ size="19px"
157
+ />
158
+ </Button>
159
+ </>
160
+ </>
161
+ }
162
+ >
163
+ {editBlock}
164
+ </EditBlockWrapper>
165
+ );
166
+ }}
167
+ </BlocksForm>
168
+ </Grid.Column>
169
+ <Grid.Column
170
+ className="landing-page-tiles"
171
+ widescreen="6"
172
+ largeScreen="6"
173
+ computer="6"
174
+ tablet="5"
175
+ mobile="7"
176
+ >
177
+ <Grid style={{ justifyContent: 'space-around' }}>
178
+ {tiles.map((item, index) => (
179
+ <Grid.Column
180
+ key={`item-${index}`}
181
+ className="item"
182
+ {...tileProps}
183
+ >
184
+ <UniversalLink href={item.link || '#'} title={item.title}>
185
+ <img
186
+ className="image"
187
+ src={`${item.image}/@@images/image`}
188
+ alt={item.title}
189
+ />
190
+ <p className="description">{item.description}</p>
191
+ </UniversalLink>
192
+ </Grid.Column>
193
+ ))}
194
+ </Grid>
195
+ </Grid.Column>
196
+ </Grid.Row>
197
+ </Grid>
198
+ <img className="slick-image" src={hiker} alt="Hiker" />
199
+ </div>
200
+ )}
201
+
202
+ <SidebarPortal selected={props.selected}>
203
+ <InlineForm
204
+ schema={schema}
205
+ title={schema.title}
206
+ onChangeField={(id, value) => {
207
+ onChangeBlock(props.block, {
208
+ ...props.data,
209
+ [id]: value,
210
+ });
211
+ }}
212
+ formData={props.data}
213
+ />
214
+ </SidebarPortal>
215
+ </>
216
+ );
217
+ };
218
+
219
+ export default Edit;