@eeacms/volto-clms-theme 1.0.146 → 1.0.147

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,22 @@ 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.147](https://github.com/eea/volto-clms-theme/compare/1.0.146...1.0.147) - 22 November 2022
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: show large spatial resolution slider values in km [joewdavies - [`30392ae`](https://github.com/eea/volto-clms-theme/commit/30392ae39b41ec77030a168eb5bbef4308b671d0)]
12
+ - feat: usecase view [ionlizarazu - [`f048009`](https://github.com/eea/volto-clms-theme/commit/f04800954d72bb70c0c9bd86a6214c4b341f8ec6)]
13
+ - feat: UseCases view [Mikel Larreategi - [`8135b9e`](https://github.com/eea/volto-clms-theme/commit/8135b9e09605fe3e3bf215c5f7d0c6b3123da677)]
14
+ - feat: remove related datasets and products from the usecase view [Mikel Larreategi - [`e379631`](https://github.com/eea/volto-clms-theme/commit/e379631fff69d4ae6ebdb505269ba0d021005969)]
15
+ - feat: new listing variation without description [Mikel Larreategi - [`241e979`](https://github.com/eea/volto-clms-theme/commit/241e9791c4a2a15670f267b835f411257bf4bfac)]
16
+ - feat: new variation [Mikel Larreategi - [`97ecea7`](https://github.com/eea/volto-clms-theme/commit/97ecea7c560f8587ca940d3fc3bcf3458d40277a)]
17
+
18
+ #### :bug: Bug Fixes
19
+
20
+ - fix: prevent dropdowns from being cut off CLMS-1542 [joewdavies - [`fdbc5e2`](https://github.com/eea/volto-clms-theme/commit/fdbc5e24cf8e61f336952a80277d6465d3d51e7a)]
21
+ - fix: prevent dropdowns from being cut off CLMS-1542 [joewdavies - [`bb516f5`](https://github.com/eea/volto-clms-theme/commit/bb516f5ae91bfb193dca7c9e7eea914af2a813b3)]
22
+
7
23
  ### [1.0.146](https://github.com/eea/volto-clms-theme/compare/1.0.145...1.0.146) - 15 November 2022
8
24
 
9
25
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.146",
3
+ "version": "1.0.147",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -66,6 +66,10 @@ const DoubleRangeFacet = (props) => {
66
66
  );
67
67
  };
68
68
 
69
+ const mToKm = (m) => {
70
+ return m >= 1000 ? Math.round((m / 1000) * 10) / 10 + 'km' : m + 'm';
71
+ };
72
+
69
73
  return (
70
74
  <fieldset className="ccl-fieldset">
71
75
  <div
@@ -78,7 +82,7 @@ const DoubleRangeFacet = (props) => {
78
82
  >
79
83
  <legend className="ccl-form-legend">{facet.title}</legend>
80
84
  </div>
81
- <div class="range-container">
85
+ <div className="range-container">
82
86
  <Segment basic padded>
83
87
  <InputRange
84
88
  minValue={startingValues.min}
@@ -92,6 +96,13 @@ const DoubleRangeFacet = (props) => {
92
96
  onChange={(changedValue) =>
93
97
  onChangeRange(changedValue, onChange, startingValues)
94
98
  }
99
+ formatLabel={(value) => {
100
+ if (facet.field.value === 'spatial_resolution') {
101
+ return mToKm(value);
102
+ } else {
103
+ return value;
104
+ }
105
+ }}
95
106
  />
96
107
  </Segment>
97
108
  <br />
@@ -112,7 +112,19 @@ const availableVariations = [
112
112
  'Files list (link to download)',
113
113
  'downloadFile',
114
114
  ),
115
+ listingVariation(
116
+ 'CclFilesWithoutDate',
117
+ false,
118
+ 'Files list (without dates)',
119
+ 'fileWithoutDates',
120
+ ),
115
121
  listingVariation('CclCardsline', false, 'Line list with Image', 'line'),
122
+ listingVariation(
123
+ 'CclCardsline-no-description',
124
+ false,
125
+ 'Line list with Image (no description)',
126
+ 'line-no-description',
127
+ ),
116
128
  listingVariation(
117
129
  'CclCardsline-color',
118
130
  false,
@@ -1,40 +1,17 @@
1
1
  import React, { useEffect } from 'react';
2
- import AnimateHeight from 'react-animate-height';
3
2
  import { useDispatch, useSelector } from 'react-redux';
4
- import { Accordion } from 'semantic-ui-react';
3
+ import { Image, Grid, List } from 'semantic-ui-react';
5
4
 
6
5
  import { getVocabulary } from '@plone/volto/actions';
7
- import { Icon } from '@plone/volto/components';
8
- import config from '@plone/volto/registry';
6
+ import { UniversalLink } from '@plone/volto/components';
7
+ import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
8
+ import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
9
9
 
10
- import { CLMSRelatedItems } from '../CLMSRelatedItems';
11
- // import { getVocabulary } from '@plone/volto/actions';
10
+ import './usecases.less';
12
11
 
13
12
  const CLMSUseCaseView = (props) => {
14
13
  const { content } = props;
15
14
 
16
- const [activeIndex, setActiveIndex] = React.useState([99]);
17
-
18
- const handleClick = ({ index }) => {
19
- const newIndex =
20
- activeIndex.indexOf(index) === -1
21
- ? [...activeIndex, index]
22
- : activeIndex.filter((item) => item !== index);
23
-
24
- setActiveIndex(newIndex);
25
- };
26
-
27
- const [activeDatasetIndex, setActiveDatasetIndex] = React.useState([99]);
28
-
29
- const handleDatasetClick = ({ datasetindex }) => {
30
- const newDatasetIndex =
31
- activeDatasetIndex.indexOf(datasetindex) === -1
32
- ? [...activeDatasetIndex, datasetindex]
33
- : activeDatasetIndex.filter((item) => item !== datasetindex);
34
-
35
- setActiveDatasetIndex(newDatasetIndex);
36
- };
37
-
38
15
  const dispatch = useDispatch();
39
16
  const TOPICS_VOCABULARY_NAME = 'clms.types.TopicsVocabulary';
40
17
  useEffect(() => {
@@ -59,146 +36,77 @@ const CLMSUseCaseView = (props) => {
59
36
  })
60
37
  .sort();
61
38
 
62
- const titleIcons = config.blocks?.blocksConfig?.accordion?.titleIcons;
63
-
64
- function iconName(iconData, iTitleIcons) {
65
- return iconData?.right_arrows
66
- ? iTitleIcons.rightPosition
67
- : iTitleIcons.leftPosition;
68
- }
69
- // console.log(getVocabulary({ vocabNameOrURL: content.topics }));
70
39
  return (
71
40
  <div className="ccl-container">
72
- <h1 className="page-title">{content.title}</h1>
73
- <div className="news-detail">
74
- {content?.image && (
75
- <figure className="news-detail-image">
76
- <img
77
- src={
78
- content?.image
79
- ? content?.image?.download
80
- : 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
81
- }
82
- alt={content?.image ? content?.image?.filename : 'Placeholder'}
83
- />
84
- <figcaption>{content?.image_caption}</figcaption>
85
- </figure>
86
- )}
87
- <div className="news-detail-content">
88
- {content?.submittingProducionYear && (
89
- <p>
90
- <strong>{'Submitting production year: '}</strong>
91
- {content?.submittingProducionYear}
92
- </p>
93
- )}
94
- {content?.responsibleOrganization && (
95
- <p>
96
- <strong>{'Responsable organization: '}</strong>
97
- {content?.responsibleOrganization}
98
- </p>
99
- )}
100
- {content?.contactName && (
101
- <p>
102
- <strong>{'Contact name: '}</strong>
103
- {content?.contactName}
104
- </p>
105
- )}
106
- {content?.contactEmail && (
107
- <p>
108
- <strong>{'Contact email: '}</strong>
109
- {content?.contactEmail}
110
- </p>
111
- )}
112
- {topicValues.length > 0 && (
113
- <>
114
- <strong>{'Use case topics: '}</strong>
115
- <ul>
41
+ {content?.external_url ? (
42
+ <UniversalLink href={content.external_url}>
43
+ <h1 className="page-title">{content.title}</h1>
44
+ </UniversalLink>
45
+ ) : (
46
+ <h1 className="page-title">{content.title}</h1>
47
+ )}
48
+ <Grid>
49
+ <Grid.Row columns={2}>
50
+ <Grid.Column width={3}>
51
+ {content?.image?.scales?.mini?.download ? (
52
+ <figure>
53
+ <Image
54
+ src={content?.image?.scales?.mini?.download}
55
+ alt={
56
+ content?.image ? content?.image?.filename : 'Placeholder'
57
+ }
58
+ />
59
+ </figure>
60
+ ) : (
61
+ <Image
62
+ src={PlaceHolder}
63
+ alt={content?.image?.alt || 'Placeholder'}
64
+ />
65
+ )}
66
+ </Grid.Column>
67
+ <Grid.Column width={9}>
68
+ {topicValues.length > 0 && (
69
+ <List celled horizontal className="usecase-topic-values-list">
116
70
  {topicValues.map((topic, key) => (
117
- <li key={key}>
71
+ <List.Item key={key}>
118
72
  <strong>{topic}</strong>
119
- </li>
73
+ </List.Item>
120
74
  ))}
121
- </ul>
122
- </>
123
- )}
124
- {content?.outcome && (
75
+ </List>
76
+ )}
125
77
  <p>
126
- <strong>{'Use case outcome: '}</strong>
127
- {content?.outcome}
78
+ <List celled horizontal className="usecase-other-values-list">
79
+ <List.Item>
80
+ {content?.submittingProducionYear && (
81
+ <span className="usecase-year">
82
+ {content?.submittingProducionYear}
83
+ </span>
84
+ )}
85
+ </List.Item>
86
+ <List.Item>
87
+ {content?.taxonomy_use_case_spatial_coverage
88
+ .map(
89
+ (taxonomy_use_case_spatial_coverage) =>
90
+ taxonomy_use_case_spatial_coverage.title,
91
+ )
92
+ .sort()
93
+ .join(', ')}
94
+ </List.Item>
95
+ <List.Item>
96
+ {content?.responsibleOrganization && (
97
+ <span className="usecase-detail-item">
98
+ {content?.responsibleOrganization}
99
+ </span>
100
+ )}
101
+ </List.Item>
102
+ </List>
128
103
  </p>
129
- )}
130
- {content?.taxonomy_use_case_spatial_coverage.length > 0 && (
131
- <>
132
- <strong>{'Geographic coverage: '}</strong>
133
- <ul>
134
- {content?.taxonomy_use_case_spatial_coverage.map(
135
- (taxonomy_use_case_spatial_coverage, key) => (
136
- <li key={key}>
137
- <strong>
138
- {taxonomy_use_case_spatial_coverage.title}
139
- </strong>
140
- </li>
141
- ),
142
- )}
143
- </ul>
144
- </>
145
- )}
146
- {content?.products?.length > 0 && (
147
- <Accordion fluid styled>
148
- <Accordion.Title
149
- as={'h2'}
150
- onClick={() => handleClick({ index: 0 })}
151
- className={'accordion-title align-arrow-right'}
152
- >
153
- {activeIndex.includes(0) ? (
154
- <Icon
155
- name={iconName(content, titleIcons.opened)}
156
- size="24px"
157
- />
158
- ) : (
159
- <Icon
160
- name={iconName(content, titleIcons.closed)}
161
- size="24px"
162
- />
163
- )}
164
- <span>Related products</span>
165
- </Accordion.Title>
166
- <Accordion.Content active={activeIndex.includes(0)}>
167
- <AnimateHeight animateOpacity duration={500} height={'auto'}>
168
- <CLMSRelatedItems items={content.products} />
169
- </AnimateHeight>
170
- </Accordion.Content>
171
- </Accordion>
172
- )}
173
- {content?.datasets?.length > 0 && (
174
- <Accordion fluid styled>
175
- <Accordion.Title
176
- as={'h2'}
177
- onClick={() => handleDatasetClick({ datasetindex: 0 })}
178
- className={'accordion-title align-arrow-right'}
179
- >
180
- {activeDatasetIndex.includes(0) ? (
181
- <Icon
182
- name={iconName(content, titleIcons.opened)}
183
- size="24px"
184
- />
185
- ) : (
186
- <Icon
187
- name={iconName(content, titleIcons.closed)}
188
- size="24px"
189
- />
190
- )}
191
- <span>Related datasets</span>
192
- </Accordion.Title>
193
- <Accordion.Content active={activeDatasetIndex.includes(0)}>
194
- <AnimateHeight animateOpacity duration={500} height={'auto'}>
195
- <CLMSRelatedItems items={content.datasets} />
196
- </AnimateHeight>
197
- </Accordion.Content>
198
- </Accordion>
199
- )}
200
- </div>
201
- </div>
104
+ <div className="usecase-body-text">
105
+ {content?.text && <StringToHTML string={content?.text?.data} />}
106
+ </div>
107
+ </Grid.Column>
108
+ </Grid.Row>
109
+ </Grid>
202
110
  </div>
203
111
  );
204
112
  };
@@ -0,0 +1,21 @@
1
+ div.ui.celled.list.usecase-topic-values-list {
2
+ padding-bottom: 1.8rem;
3
+ }
4
+
5
+ div.ui.celled.list.usecase-topic-values-list .item:first-child,
6
+ div.ui.celled.list.usecase-other-values-list .item:first-child {
7
+ border-left: none;
8
+ }
9
+
10
+ div.ui.celled.list.usecase-topic-values-list .item:last-child,
11
+ div.ui.celled.list.usecase-other-values-list .item:last-child {
12
+ border-right: none;
13
+ }
14
+
15
+ div.ui.celled.list span.usecase-year {
16
+ font-size: 1.1rem;
17
+ }
18
+
19
+ div.usecase-body-text {
20
+ padding-left: 0.5em;
21
+ }
@@ -109,6 +109,7 @@ function CclCard(props) {
109
109
  'globalSearch',
110
110
  'file',
111
111
  'downloadFile',
112
+ 'fileWithoutDates',
112
113
  ];
113
114
  const wrapperClass =
114
115
  'card-' +
@@ -116,7 +117,12 @@ function CclCard(props) {
116
117
  ? 'doc'
117
118
  : type === 'downloadFile'
118
119
  ? 'file'
120
+ : type === 'fileWithoutDates'
121
+ ? 'file card-file-aligned'
122
+ : type === 'line-no-description'
123
+ ? 'line card-line-no-description'
119
124
  : type || 'line');
125
+
120
126
  return (
121
127
  <CardLink
122
128
  url={url}
@@ -183,6 +189,19 @@ function CclCard(props) {
183
189
  </div>
184
190
  </>
185
191
  )}
192
+ {type === 'fileWithoutDates' && (
193
+ <>
194
+ <div className="card-icon">
195
+ <Icon name="file alternate outline" />
196
+ </div>
197
+ <div className="card-text">
198
+ <div className="card-file-title">
199
+ <CardLink url={url}>{card?.title}</CardLink>
200
+ </div>
201
+ {children}
202
+ </div>
203
+ </>
204
+ )}
186
205
  {type === 'globalSearch' && (
187
206
  <>
188
207
  <Label ribbon="right" color="olive">
@@ -290,7 +309,9 @@ function CclCard(props) {
290
309
  <CardLink url={url}>{card?.title}</CardLink>
291
310
  {/* <CardLink url={url} title={card?.title} /> */}
292
311
  </div>
293
- <div className="card-description">{card?.description}</div>
312
+ {type !== 'line-no-description' && (
313
+ <div className="card-description">{card?.description}</div>
314
+ )}
294
315
  {children}
295
316
  </div>
296
317
  </>
@@ -2,6 +2,7 @@
2
2
  .card-line {
3
3
  position: relative;
4
4
  display: flex;
5
+ width: 100%;
5
6
  padding: 1rem 0;
6
7
  }
7
8
 
@@ -26,6 +27,10 @@
26
27
  object-fit: cover;
27
28
  }
28
29
 
30
+ .card-line-no-description {
31
+ align-items: center;
32
+ }
33
+
29
34
  .card-text {
30
35
  width: 100%;
31
36
  }
@@ -86,6 +91,14 @@
86
91
  color: #adb0b8;
87
92
  }
88
93
 
94
+ .card-file-aligned {
95
+ align-items: center;
96
+ }
97
+
98
+ .card-file-aligned .card-file-title {
99
+ margin-bottom: 0;
100
+ }
101
+
89
102
  .card-line-color .card-image {
90
103
  width: 12rem;
91
104
  height: 12rem;
@@ -1275,4 +1275,9 @@ div#page-document h1.documentFirstHeading {
1275
1275
  .technical-library-edit-link {
1276
1276
  vertical-align: middle;
1277
1277
  margin-left: 5px;
1278
+ }
1279
+
1280
+ // CLMS-1542
1281
+ main {
1282
+ overflow: visible !important;
1278
1283
  }