@eeacms/volto-clms-theme 1.0.85 → 1.0.86

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,8 +4,17 @@ 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.86](https://github.com/eea/volto-clms-theme/compare/1.0.85...1.0.86)
8
+
9
+ - News item view and blocks [`#242`](https://github.com/eea/volto-clms-theme/pull/242)
10
+ - NewsItem with blocks [`5320bd3`](https://github.com/eea/volto-clms-theme/commit/5320bd3073f7528d511d49b41755a5ebea05ba20)
11
+ - if a news item has blocks render them [`5795bd4`](https://github.com/eea/volto-clms-theme/commit/5795bd47a8215a575142bfe5a42713f2ed2b540b)
12
+
7
13
  #### [1.0.85](https://github.com/eea/volto-clms-theme/compare/1.0.84...1.0.85)
8
14
 
15
+ > 22 March 2022
16
+
17
+ - Upgrade to Volto 15.2.1 [`#241`](https://github.com/eea/volto-clms-theme/pull/241)
9
18
  - Volto 15 upgrade [`#240`](https://github.com/eea/volto-clms-theme/pull/240)
10
19
  - jest config [`5e0723b`](https://github.com/eea/volto-clms-theme/commit/5e0723b1c1006609811a84d6fb9a3b6744c8d1be)
11
20
  - sort downloads [`50cdd33`](https://github.com/eea/volto-clms-theme/commit/50cdd332f992e45a8745483bddaf25e01ecd5db5)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.85",
3
+ "version": "1.0.86",
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",
@@ -1,32 +1,42 @@
1
1
  import React from 'react';
2
2
  import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
3
+ import { hasBlocksData } from '@plone/volto/helpers';
4
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
3
5
 
4
6
  const CLMSNewsItemView = (props) => {
5
7
  const { content } = props;
6
8
  return (
7
9
  <div className="ccl-container">
8
- <h1 className="page-title">{content.title}</h1>
9
- <div className="news-detail">
10
- <div className="news-detail-date">
11
- {new Date(content?.effective).toLocaleString()}
12
- </div>
13
- {content?.image && (
14
- <figure className="news-detail-image">
15
- <img
16
- src={
17
- content?.image
18
- ? content?.image?.download
19
- : 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
20
- }
21
- alt={content?.image ? content?.image?.filename : 'Placeholder'}
22
- />
23
- <figcaption>{content?.image_caption}</figcaption>
24
- </figure>
25
- )}
26
- <div className="news-detail-content">
27
- <StringToHTML string={content.text?.data || ''} />
28
- </div>
29
- </div>
10
+ {hasBlocksData(content) && content.blocks_layout?.items?.length > 1 ? (
11
+ <RenderBlocks {...props} />
12
+ ) : (
13
+ <>
14
+ <h1 className="page-title">{content.title}</h1>
15
+ <div className="news-detail">
16
+ <div className="news-detail-date">
17
+ {new Date(content?.effective).toLocaleDateString()}
18
+ </div>
19
+ {content?.image && (
20
+ <figure className="news-detail-image">
21
+ <img
22
+ src={
23
+ content?.image
24
+ ? content?.image?.download
25
+ : 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
26
+ }
27
+ alt={
28
+ content?.image ? content?.image?.filename : 'Placeholder'
29
+ }
30
+ />
31
+ <figcaption>{content?.image_caption}</figcaption>
32
+ </figure>
33
+ )}
34
+ <div className="news-detail-content">
35
+ <StringToHTML string={content.text?.data || ''} />
36
+ </div>
37
+ </div>
38
+ </>
39
+ )}
30
40
  </div>
31
41
  );
32
42
  };