@eeacms/volto-hero-block 2.0.0 → 3.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,15 +4,29 @@ 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
- ### [2.0.0](https://github.com/eea/volto-hero-block/compare/1.0.0...2.0.0) - 15 November 2022
7
+ ### [3.0.0](https://github.com/eea/volto-hero-block/compare/2.1.0...3.0.0) - 22 December 2022
8
8
 
9
- #### :nail_care: Enhancements
9
+ #### :rocket: New Features
10
10
 
11
- - refactor(Styling): Use schemaEnhancer in favor of StyleWrapper [Alin Voinea - [`dacf4db`](https://github.com/eea/volto-hero-block/commit/dacf4db6c59a584639f13c7ce8a3d7bd808ea64c)]
11
+ - feat(copyright): Add image copyright info - refs #158210 [Alin Voinea - [`f0f2b09`](https://github.com/eea/volto-hero-block/commit/f0f2b09633baddcd6f11ccf52bf9e40652dcbfad)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Cosmetics [Alin Voinea - [`9dac70c`](https://github.com/eea/volto-hero-block/commit/9dac70c0a3bea8e188ede9123f4f99de8e0f6987)]
16
+ - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2d4005f`](https://github.com/eea/volto-hero-block/commit/2d4005f0f31b121e1b7d2e94414f3dff92ec1a16)]
17
+ ### [2.1.0](https://github.com/eea/volto-hero-block/compare/2.0.0...2.1.0) - 12 December 2022
18
+
19
+ #### :bug: Bug Fixes
12
20
 
13
- #### :house: Internal changes
21
+ - fix(gif): Use ES6 with isImageGif utility - refs #158188 [Alin Voinea - [`ad32432`](https://github.com/eea/volto-hero-block/commit/ad32432ee320bb4e43f20e260f2900269adf0401)]
14
22
 
15
- - style(volto-hero-block): set correctly the background color [Miu Razvan - [`9358a17`](https://github.com/eea/volto-hero-block/commit/9358a1777c25664cbfe9c66a6c9054521a11ff24)]
23
+ #### :hammer_and_wrench: Others
24
+
25
+ ## [2.0.0](https://github.com/eea/volto-hero-block/compare/1.0.0...2.0.0) - 16 November 2022
26
+
27
+ #### :nail_care: Enhancements
28
+
29
+ - refactor(Styling): Use schemaEnhancer in favor of StyleWrapper [Alin Voinea - [`dacf4db`](https://github.com/eea/volto-hero-block/commit/dacf4db6c59a584639f13c7ce8a3d7bd808ea64c)]
16
30
 
17
31
  #### :hammer_and_wrench: Others
18
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "@eeacms/volto-hero-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -23,8 +23,8 @@
23
23
  "@eeacms/volto-object-widget": "*"
24
24
  },
25
25
  "devDependencies": {
26
- "@plone/scripts": "*",
27
26
  "@cypress/code-coverage": "^3.10.0",
27
+ "@plone/scripts": "*",
28
28
  "babel-plugin-transform-class-properties": "^6.24.1",
29
29
  "md5": "^2.3.0"
30
30
  },
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ Copyright.propTypes = {
5
+ copyrightPosition: PropTypes.oneOf(['left', 'right']),
6
+ };
7
+
8
+ function Copyright({ children, ...rest }) {
9
+ return (
10
+ <div className={`eea copyright ${rest.copyrightPosition}`}>
11
+ <div className={'wrapper'}>{children}</div>
12
+ </div>
13
+ );
14
+ }
15
+
16
+ Copyright.Icon = ({ children, ...rest }) => (
17
+ <span {...rest} className={'icon-wrapper'}>
18
+ {children}
19
+ </span>
20
+ );
21
+
22
+ Copyright.Text = ({ children, ...rest }) => (
23
+ <span {...rest} className={'icon-content'}>
24
+ {children}
25
+ </span>
26
+ );
27
+ export default Copyright;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { connect } from 'react-redux';
4
+ import { Icon } from 'semantic-ui-react';
4
5
  import config from '@plone/volto/registry';
5
6
  import {
6
7
  BlockDataForm,
@@ -16,6 +17,7 @@ import {
16
17
 
17
18
  import { createSlateHeader } from '@eeacms/volto-hero-block/helpers';
18
19
 
20
+ import Copyright from './Copyright';
19
21
  import Hero from './Hero';
20
22
  import getSchema from './schema';
21
23
 
@@ -45,7 +47,7 @@ const Edit = (props) => {
45
47
  onChangeBlock,
46
48
  onSelectBlock,
47
49
  } = props;
48
- const { text } = data;
50
+ const { text, copyright, copyrightIcon, copyrightPosition } = data;
49
51
  const schema = React.useMemo(() => getSchema(props), [props]);
50
52
 
51
53
  const withBlockProperties = React.useCallback(
@@ -89,6 +91,16 @@ const Edit = (props) => {
89
91
  <Hero.Meta {...data}>
90
92
  <Metadata {...data} />
91
93
  </Hero.Meta>
94
+ {copyright ? (
95
+ <Copyright copyrightPosition={copyrightPosition}>
96
+ <Copyright.Icon>
97
+ <Icon className={copyrightIcon} />
98
+ </Copyright.Icon>
99
+ <Copyright.Text>{copyright}</Copyright.Text>
100
+ </Copyright>
101
+ ) : (
102
+ ''
103
+ )}
92
104
  </Hero>
93
105
 
94
106
  <SidebarPortal selected={selected}>
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
4
  import { isInternalURL } from '@plone/volto/helpers/Url/Url';
5
+ import { isImageGif } from '@eeacms/volto-hero-block/helpers';
5
6
 
6
7
  Hero.propTypes = {
7
8
  image: PropTypes.string,
@@ -63,6 +64,8 @@ function Hero({
63
64
  ? {
64
65
  backgroundImage: isExternal
65
66
  ? `url(${image})`
67
+ : isImageGif(image)
68
+ ? `url(${image}/@@images/image)`
66
69
  : `url(${image}/@@images/image/huge)`,
67
70
  }
68
71
  : {}
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
+ import { Icon } from 'semantic-ui-react';
3
4
  import { UniversalLink } from '@plone/volto/components';
4
5
  import Hero from './Hero';
6
+ import Copyright from './Copyright';
5
7
  import { serializeText } from '@eeacms/volto-hero-block/helpers';
6
8
 
7
9
  const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
@@ -21,13 +23,23 @@ const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
21
23
 
22
24
  const View = (props) => {
23
25
  const { data = {} } = props;
24
- const { text } = data;
26
+ const { text, copyright, copyrightIcon, copyrightPosition } = data;
25
27
  return (
26
28
  <Hero {...data}>
27
29
  <Hero.Text {...data}>{serializeText(text)}</Hero.Text>
28
30
  <Hero.Meta {...data}>
29
31
  <Metadata {...data} />
30
32
  </Hero.Meta>
33
+ {copyright ? (
34
+ <Copyright copyrightPosition={copyrightPosition}>
35
+ <Copyright.Icon>
36
+ <Icon className={copyrightIcon} />
37
+ </Copyright.Icon>
38
+ <Copyright.Text>{copyright}</Copyright.Text>
39
+ </Copyright>
40
+ ) : (
41
+ ''
42
+ )}
31
43
  </Hero>
32
44
  );
33
45
  };
@@ -19,6 +19,11 @@ export default () => {
19
19
  'image',
20
20
  ],
21
21
  },
22
+ {
23
+ id: 'copyright',
24
+ title: 'Copyright',
25
+ fields: ['copyright', 'copyrightIcon', 'copyrightPosition'],
26
+ },
22
27
  ],
23
28
  properties: {
24
29
  fullWidth: {
@@ -63,6 +68,19 @@ export default () => {
63
68
  title: 'Image',
64
69
  widget: 'attachedimage',
65
70
  },
71
+ copyright: {
72
+ title: 'Text',
73
+ },
74
+ copyrightIcon: {
75
+ title: 'Icon',
76
+ default: 'ri-copyright-line',
77
+ },
78
+ copyrightPosition: {
79
+ title: 'Align',
80
+ widget: 'align',
81
+ actions: ['left', 'right'],
82
+ defaultValue: 'left',
83
+ },
66
84
  },
67
85
  required: [],
68
86
  };
package/src/helpers.js CHANGED
@@ -15,3 +15,7 @@ export const createSlateHeader = (text) => {
15
15
  export const serializeText = (text) => {
16
16
  return isArray(text) ? serializeNodes(text) : text;
17
17
  };
18
+
19
+ export const isImageGif = (image) => {
20
+ return image?.endsWith?.('.gif');
21
+ };