@eeacms/volto-eea-map 0.1.35 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.0.0](https://github.com/eea/volto-eea-map/compare/0.1.35...1.0.0) - 15 June 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: fix style #254131 [Andrei Grigore - [`e0d1bf6`](https://github.com/eea/volto-eea-map/commit/e0d1bf6092d07ac0d2f98ff6febc9c01d97ce654)]
12
+ - fix: fix style #254131 [Andrei Grigore - [`2361110`](https://github.com/eea/volto-eea-map/commit/2361110243bc42d15ebcde736a811ad9260b92cb)]
13
+ - fix: fix style #254131 [Andrei Grigore - [`c846eb9`](https://github.com/eea/volto-eea-map/commit/c846eb9cbe1376f3c8c11b77a70dc123230bb6ec)]
14
+ - fix: fix style #254131 [Andrei Grigore - [`a6b962d`](https://github.com/eea/volto-eea-map/commit/a6b962d007d0d32c1ca8e7304ac75ce58e41c173)]
15
+
16
+ #### :house: Internal changes
17
+
18
+ - chore: increase version #254131 [Andrei Grigore - [`ec022cc`](https://github.com/eea/volto-eea-map/commit/ec022cc3b3d0c5e4b9158e7f28cf35edc5654600)]
19
+
7
20
  ### [0.1.35](https://github.com/eea/volto-eea-map/compare/0.1.34...0.1.35) - 14 June 2023
8
21
 
9
22
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.35",
3
+ "version": "1.0.0",
4
4
  "description": "@eeacms/volto-eea-map: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -9,7 +9,6 @@ import { getContent } from '@plone/volto/actions';
9
9
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
10
10
  import Webmap from '@eeacms/volto-eea-map/components/Webmap';
11
11
  import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
12
- import '@eeacms/volto-eea-map/styles/map.css';
13
12
 
14
13
  import { Schema } from './Schema';
15
14
  import {
@@ -1,47 +1,7 @@
1
1
  import React from 'react';
2
- import { UniversalLink, Icon } from '@plone/volto/components';
3
-
4
2
  import { serializeNodes } from '@plone/volto-slate/editor/render';
5
-
6
- import rightKeySVG from '@plone/volto/icons/right-key.svg';
7
- import downKeySVG from '@plone/volto/icons/down-key.svg';
8
3
  import LegendView from '@eeacms/volto-eea-map/components/LegendView';
9
-
10
- const SourcesWidget = ({ data }) => {
11
- const [expand, setExpand] = React.useState(true);
12
-
13
- return (
14
- <div>
15
- <button className="legend-action" onClick={() => setExpand(!expand)}>
16
- <h3>
17
- <Icon
18
- name={expand ? downKeySVG : rightKeySVG}
19
- title={expand ? 'Collapse' : 'Expand'}
20
- size="17px"
21
- />
22
- Sources:
23
- </h3>
24
- </button>
25
- {expand && (
26
- <ul>
27
- {data.map((param, i) => (
28
- <li key={i}>
29
- <div className="map_source_param_container">
30
- <UniversalLink className="map_source_title" href={param.link}>
31
- {param.title}
32
- </UniversalLink>
33
- ,
34
- <span className="map_source_description">
35
- {param.organisation}
36
- </span>
37
- </div>
38
- </li>
39
- ))}
40
- </ul>
41
- )}
42
- </div>
43
- );
44
- };
4
+ import Sources from './Sources';
45
5
 
46
6
  const ExtraViews = ({ data }) => {
47
7
  const {
@@ -58,17 +18,7 @@ const ExtraViews = ({ data }) => {
58
18
  {show_legend && map_data && (
59
19
  <LegendView data={map_data} show_viewer={show_viewer} />
60
20
  )}
61
- {show_sources && (
62
- <>
63
- {data_provenance &&
64
- data_provenance.data &&
65
- data_provenance.data.length > 0 ? (
66
- <SourcesWidget data={data_provenance.data} />
67
- ) : (
68
- <p>Data provenance is not set for visualization used or page</p>
69
- )}
70
- </>
71
- )}
21
+ {show_sources && <Sources sources={data_provenance?.data} />}
72
22
  {description && serializeNodes(description)}
73
23
  </div>
74
24
  );
@@ -116,14 +116,14 @@ const LegendView = (props) => {
116
116
  <>
117
117
  <div className="legend-container">
118
118
  <button className="legend-action" onClick={() => setExpand(!expand)}>
119
- <h3 role="presentation" className="legend-title">
120
- <Icon
121
- name={expand ? downKeySVG : rightKeySVG}
122
- title={expand ? 'Collapse' : 'Expand'}
123
- size="17px"
124
- />
125
- Legend:
126
- </h3>
119
+ {/* <h3 role="presentation" className="legend-title"> */}
120
+ <Icon
121
+ name={expand ? downKeySVG : rightKeySVG}
122
+ title={expand ? 'Collapse' : 'Expand'}
123
+ size="17px"
124
+ />
125
+ Legend:
126
+ {/* </h3> */}
127
127
  </button>
128
128
  <Grid columns={legendColumns}>
129
129
  {(!map_layers || map_layers.length === 0) && (
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import { Popup } from 'semantic-ui-react';
4
+ import { UniversalLink } from '@plone/volto/components';
5
+
6
+ const Link = ({ children, ...props }) => {
7
+ if (props.href) {
8
+ return <UniversalLink {...props}>{children}</UniversalLink>;
9
+ }
10
+ return <span {...props}>{children}</span>;
11
+ };
12
+
13
+ const Source = ({ source }) => {
14
+ if (source.chart_source_link && source.chart_source) {
15
+ return <Link href={source.chart_source_link}>{source.chart_source}</Link>;
16
+ }
17
+ if (source.chart_source) {
18
+ return <span>{source.chart_source}</span>;
19
+ }
20
+ return (
21
+ <>
22
+ <Link className="embed-sources-param-title" href={source.link}>
23
+ {source.title}
24
+ </Link>
25
+ ,<span style={{ marginLeft: '5px' }}>{source.organisation}</span>
26
+ </>
27
+ );
28
+ };
29
+
30
+ const SourcesWidget = ({ sources }) => {
31
+ const [expanded, setExpanded] = React.useState(false);
32
+ return (
33
+ <div className="eea-map-sources-container">
34
+ <Popup
35
+ content={
36
+ sources?.length ? (
37
+ <ol className="eea-map-sources-list">
38
+ {sources?.map((source, index) => {
39
+ return (
40
+ <li key={index}>
41
+ <Source source={source} />
42
+ </li>
43
+ );
44
+ })}
45
+ </ol>
46
+ ) : (
47
+ <p>Data provenance is not set for this visualization.</p>
48
+ )
49
+ }
50
+ position="bottom left"
51
+ popper={{ id: 'eea-map-sources-popup' }}
52
+ trigger={
53
+ <button className={cx('eea-map-sources-button', { expanded })}>
54
+ Sources
55
+ </button>
56
+ }
57
+ on="click"
58
+ onClose={() => {
59
+ setExpanded(false);
60
+ }}
61
+ onOpen={() => {
62
+ setExpanded(true);
63
+ }}
64
+ />
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default SourcesWidget;
package/src/index.js CHANGED
@@ -14,6 +14,8 @@ import SimpleColorPickerWidget from './components/widgets/SimpleColorPickerWidge
14
14
  import { data_visualizations } from './middlewares';
15
15
  import * as addonReducers from './reducers';
16
16
 
17
+ import './less/global.less';
18
+
17
19
  export default (config) => {
18
20
  config.settings.allowed_cors_destinations = [
19
21
  ...(config.settings.allowed_cors_destinations || []),
@@ -1,3 +1,21 @@
1
+ @import (multiple, reference, optional) '../../theme.config';
2
+
3
+ /* Enables customization of addons */
4
+ .loadAddonOverrides() {
5
+ @import (optional)
6
+ '@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.overrides';
7
+ }
8
+
9
+ /* Helper to load variables */
10
+ .loadAddonVariables() {
11
+ @import (optional) '@{addonelement}.variables';
12
+ @import (optional)
13
+ '@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.variables';
14
+ }
15
+
16
+ @import './variables.less';
17
+
18
+ // TODO: pull out colors and dimensions into variables
1
19
  .map-edit-container {
2
20
  display: flex;
3
21
  }
@@ -162,6 +180,8 @@
162
180
  }
163
181
 
164
182
  .legend-container {
183
+ display: flex;
184
+ flex-direction: column;
165
185
  margin: 15px 0;
166
186
  }
167
187
 
@@ -179,10 +199,20 @@
179
199
  }
180
200
 
181
201
  .legend-action {
182
- padding: 10px 0;
202
+ z-index: 22;
203
+ display: inline-flex;
204
+ align-items: center;
205
+ padding-bottom: 3px;
183
206
  border: none;
184
207
  background: transparent;
208
+ background-color: transparent;
209
+ color: #3d5265;
185
210
  cursor: pointer;
211
+ font-weight: bold;
212
+
213
+ &:hover {
214
+ color: @secondaryColor;
215
+ }
186
216
  }
187
217
 
188
218
  .map-number-input {
@@ -195,6 +225,46 @@
195
225
  color: green;
196
226
  }
197
227
 
228
+ /* sources */
229
+
230
+ .eea-map-sources-list {
231
+ margin: 0;
232
+ list-style: decimal inside;
233
+ padding-inline-start: 0;
234
+ }
235
+
236
+ #eea-map-sources-popup .ui.popup {
237
+ min-width: 600px;
238
+ background-color: #f9f9f9;
239
+ box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
240
+ }
241
+
242
+ .eea-map-sources-button {
243
+ display: inline-flex;
244
+ align-items: center;
245
+ padding-top: 10px;
246
+ padding-bottom: 3px;
247
+ border: none;
248
+ background-color: transparent;
249
+ color: @textColor;
250
+ cursor: pointer;
251
+ font-weight: bold;
252
+
253
+ .icon {
254
+ margin-left: 0.5rem;
255
+ }
256
+
257
+ &:hover {
258
+ color: @secondaryColor;
259
+ }
260
+
261
+ &.expanded {
262
+ padding-bottom: 0;
263
+ border-bottom: 3px solid @secondaryColor;
264
+ color: @secondaryColor;
265
+ }
266
+ }
267
+
198
268
  @keyframes fadeDown {
199
269
  from {
200
270
  opacity: 0;
@@ -212,4 +282,9 @@
212
282
  max-width: 0.2cm;
213
283
  height: 0.2cm;
214
284
  }
285
+
286
+ .eea-map-sources-container,
287
+ #eea-map-sources-popup {
288
+ display: none;
289
+ }
215
290
  }
@@ -0,0 +1,5 @@
1
+ @type: extra;
2
+
3
+ @element: custom;
4
+
5
+ @grey-1: #f9f9f9;