@eeacms/volto-hero-block 5.2.0 → 5.3.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.
- package/CHANGELOG.md +33 -1
- package/package.json +1 -1
- package/src/components/Blocks/Hero/Copyright.jsx +9 -0
- package/src/components/Blocks/Hero/Edit.jsx +2 -0
- package/src/components/Blocks/Hero/Hero.jsx +2 -2
- package/src/components/Blocks/Hero/View.jsx +3 -0
- package/src/components/Blocks/Hero/index.js +1 -0
- package/src/components/Blocks/Hero/schema.js +12 -0
- package/src/hooks.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,30 @@ 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
|
+
### [5.3.1](https://github.com/eea/volto-hero-block/compare/5.3.0...5.3.1) - 22 May 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- put return statement [Dobricean Ioan Dorian - [`8eff5fd`](https://github.com/eea/volto-hero-block/commit/8eff5fdf977fcbb8cc952d3f45b577b02ca59cb9)]
|
|
12
|
+
- change name and refactor to be more efficent [Dobricean Ioan Dorian - [`ff24145`](https://github.com/eea/volto-hero-block/commit/ff2414542833998ef282376de3fbda8698287849)]
|
|
13
|
+
- stop-image-disappear over and over [Dobricean Ioan Dorian - [`c5b6f54`](https://github.com/eea/volto-hero-block/commit/c5b6f545ac422d95b8d802349aa4cf27af820829)]
|
|
14
|
+
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`3d38dd0`](https://github.com/eea/volto-hero-block/commit/3d38dd09a36525bda448f67a6d218bc7690a4cc3)]
|
|
15
|
+
### [5.3.0](https://github.com/eea/volto-hero-block/compare/5.2.0...5.3.0) - 27 March 2023
|
|
16
|
+
|
|
17
|
+
#### :rocket: New Features
|
|
18
|
+
|
|
19
|
+
- feat(copyright): Possibility to arbitrary add prefix text to copyright info - refs #250724 [Alin Voinea - [`f0b9944`](https://github.com/eea/volto-hero-block/commit/f0b994458d737b2c23bcf0b73e39b8dfbbcc321e)]
|
|
20
|
+
|
|
21
|
+
#### :house: Internal changes
|
|
22
|
+
|
|
23
|
+
- chore(Hero): Keep Hero block backward compatible if no copyrightPrefix provided - refs #250724 [Alin Voinea - [`2b17631`](https://github.com/eea/volto-hero-block/commit/2b176317c94856dd9424dcd92699c93d2f0dc066)]
|
|
24
|
+
|
|
7
25
|
### [5.2.0](https://github.com/eea/volto-hero-block/compare/5.1.0...5.2.0) - 24 March 2023
|
|
8
26
|
|
|
9
27
|
#### :hammer_and_wrench: Others
|
|
10
28
|
|
|
11
29
|
- Release 5.2.0 [Alin Voinea - [`b0dfa0c`](https://github.com/eea/volto-hero-block/commit/b0dfa0c46f5f697d9e2419522ce04ead9353272d)]
|
|
12
30
|
- update [Miu Razvan - [`2a9e854`](https://github.com/eea/volto-hero-block/commit/2a9e8540853cd49e7461ac4de9fef2109874dcdd)]
|
|
13
|
-
- import schema from blocksConfig [Miu Razvan - [`196a003`](https://github.com/eea/volto-hero-block/commit/196a003957676b562987ef6509cf2b73ea2e77d2)]
|
|
14
31
|
### [5.1.0](https://github.com/eea/volto-hero-block/compare/5.0.0...5.1.0) - 24 March 2023
|
|
15
32
|
|
|
16
33
|
#### :hammer_and_wrench: Others
|
|
@@ -33,9 +50,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
33
50
|
- fix onScreen hook error #16 from eea/fix-onscreen-hook [ichim-david - [`9123541`](https://github.com/eea/volto-hero-block/commit/91235413f423d7e6c4788d70b687b3ed5d4884b4)]
|
|
34
51
|
- no need for comments [andreiggr - [`a14f9c3`](https://github.com/eea/volto-hero-block/commit/a14f9c3bdddfa22e6b4bbc8318f0ca5bdc9c2d38)]
|
|
35
52
|
- fix hook [andreiggr - [`f7fae73`](https://github.com/eea/volto-hero-block/commit/f7fae73007f79af2f06da1d9b72a53ad86fef4ac)]
|
|
53
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6b78fc0`](https://github.com/eea/volto-hero-block/commit/6b78fc044a933ab9b4b4694901aa26628ef0a836)]
|
|
36
54
|
- eslint [andreiggr - [`68451b7`](https://github.com/eea/volto-hero-block/commit/68451b725420015fbd5b695e97b8742988d49913)]
|
|
37
55
|
- lazy load huge img on first 10px [andreiggr - [`67dc7d3`](https://github.com/eea/volto-hero-block/commit/67dc7d3475188d692e053032c2639dd1a585c029)]
|
|
38
56
|
- lazy load huge bgimage wip [andreiggr - [`86e45ec`](https://github.com/eea/volto-hero-block/commit/86e45ece842f1cd7452920dffa3a9b4aea945f56)]
|
|
57
|
+
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`87cbb38`](https://github.com/eea/volto-hero-block/commit/87cbb383290a168f85703573670e17f4e1ed7747)]
|
|
39
58
|
## [4.0.0](https://github.com/eea/volto-hero-block/compare/3.0.1...4.0.0) - 7 February 2023
|
|
40
59
|
|
|
41
60
|
#### :nail_care: Enhancements
|
|
@@ -61,6 +80,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
61
80
|
|
|
62
81
|
#### :hammer_and_wrench: Others
|
|
63
82
|
|
|
83
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`ab85c7b`](https://github.com/eea/volto-hero-block/commit/ab85c7bd5bd1e3aec95e02f9b4d026b1203d5739)]
|
|
64
84
|
## [3.0.0](https://github.com/eea/volto-hero-block/compare/2.1.0...3.0.0) - 22 December 2022
|
|
65
85
|
|
|
66
86
|
#### :rocket: New Features
|
|
@@ -69,8 +89,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
69
89
|
|
|
70
90
|
#### :hammer_and_wrench: Others
|
|
71
91
|
|
|
92
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f06f58c`](https://github.com/eea/volto-hero-block/commit/f06f58c7cd4cfc15a03208e9c7a4e31fe2eba2f6)]
|
|
93
|
+
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`20e5bcb`](https://github.com/eea/volto-hero-block/commit/20e5bcb3c4dd538595741928319c3204c5d18f8c)]
|
|
72
94
|
- Cosmetics [Alin Voinea - [`9dac70c`](https://github.com/eea/volto-hero-block/commit/9dac70c0a3bea8e188ede9123f4f99de8e0f6987)]
|
|
73
95
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2d4005f`](https://github.com/eea/volto-hero-block/commit/2d4005f0f31b121e1b7d2e94414f3dff92ec1a16)]
|
|
96
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`2931fcc`](https://github.com/eea/volto-hero-block/commit/2931fccbee5f8e117e5ae9095ba57e63e465ddb3)]
|
|
74
97
|
### [2.1.0](https://github.com/eea/volto-hero-block/compare/2.0.0...2.1.0) - 12 December 2022
|
|
75
98
|
|
|
76
99
|
#### :bug: Bug Fixes
|
|
@@ -79,6 +102,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
79
102
|
|
|
80
103
|
#### :hammer_and_wrench: Others
|
|
81
104
|
|
|
105
|
+
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`93be4f9`](https://github.com/eea/volto-hero-block/commit/93be4f96fb72cacfc25f9b058cb379d80060ee13)]
|
|
106
|
+
- yarn 3 [Alin Voinea - [`8e2dccd`](https://github.com/eea/volto-hero-block/commit/8e2dccd47cbef3c0871407baa376ce61c540c754)]
|
|
107
|
+
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`6bc3af3`](https://github.com/eea/volto-hero-block/commit/6bc3af35b4edf07971d1b0ce1648965e8d6e3bc0)]
|
|
108
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`d7dbbd2`](https://github.com/eea/volto-hero-block/commit/d7dbbd21277dd76bf59d91a4dc8e022b2a6ff99c)]
|
|
109
|
+
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`3c1f0d6`](https://github.com/eea/volto-hero-block/commit/3c1f0d6e7f8e5318aee3413ec3687d8492376f9d)]
|
|
110
|
+
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`843017a`](https://github.com/eea/volto-hero-block/commit/843017aa7dbea71cc7888663496e352d287440b4)]
|
|
82
111
|
## [2.0.0](https://github.com/eea/volto-hero-block/compare/1.0.0...2.0.0) - 16 November 2022
|
|
83
112
|
|
|
84
113
|
#### :nail_care: Enhancements
|
|
@@ -88,6 +117,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
88
117
|
#### :hammer_and_wrench: Others
|
|
89
118
|
|
|
90
119
|
- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`b8f0971`](https://github.com/eea/volto-hero-block/commit/b8f0971b21a5334d40c1b8f5103cea61d9ffe6f1)]
|
|
120
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`581dedf`](https://github.com/eea/volto-hero-block/commit/581dedf07410ef2ca09e6ddaa05fbf176400adbb)]
|
|
91
121
|
## [1.0.0](https://github.com/eea/volto-hero-block/compare/0.2.0...1.0.0) - 28 October 2022
|
|
92
122
|
|
|
93
123
|
#### :nail_care: Enhancements
|
|
@@ -99,6 +129,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
99
129
|
- Remove cypress.json [Alin Voinea - [`593bdf2`](https://github.com/eea/volto-hero-block/commit/593bdf207ca4fd3f2393117b6f64a44727881ad0)]
|
|
100
130
|
- test(cypress): Upgrade to Cypress 10 / Razzle 4 [Alin Voinea - [`edd48a5`](https://github.com/eea/volto-hero-block/commit/edd48a5c13824bce5e03e46790f1890656b340d8)]
|
|
101
131
|
- Cleanup [Alin Voinea - [`9d72ee7`](https://github.com/eea/volto-hero-block/commit/9d72ee7a06d1c6fed46586d30bb85eae39e670bf)]
|
|
132
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`95986d0`](https://github.com/eea/volto-hero-block/commit/95986d0b8fd5c3cbb9e6da9059f71e066a8e171b)]
|
|
102
133
|
### [0.2.0](https://github.com/eea/volto-hero-block/compare/0.1.4...0.2.0) - 6 July 2022
|
|
103
134
|
|
|
104
135
|
#### :bug: Bug Fixes
|
|
@@ -137,6 +168,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
137
168
|
- Update slate footnote support [Miu Razvan - [`c1522b4`](https://github.com/eea/volto-hero-block/commit/c1522b4164dbe6de01771d211d7e0bf3009f44d4)]
|
|
138
169
|
- Use justify content for text and button as well [Miu Razvan - [`08599cc`](https://github.com/eea/volto-hero-block/commit/08599cc45546d9b349128c4f8ce9c01318385811)]
|
|
139
170
|
- Add dependencies [Miu Razvan - [`30e2881`](https://github.com/eea/volto-hero-block/commit/30e2881a2a97a899e7f4cc614a0405c300ac6fee)]
|
|
171
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b415422`](https://github.com/eea/volto-hero-block/commit/b41542285edd29440a324b101a4dbae9334830bf)]
|
|
140
172
|
### 0.1.0 - 10 June 2022
|
|
141
173
|
|
|
142
174
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -13,6 +13,15 @@ function Copyright({ children, ...rest }) {
|
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
Copyright.Prefix = ({ children, ...rest }) =>
|
|
17
|
+
children ? (
|
|
18
|
+
<span {...rest} className={'icon-prefix'}>
|
|
19
|
+
{children}
|
|
20
|
+
</span>
|
|
21
|
+
) : (
|
|
22
|
+
''
|
|
23
|
+
);
|
|
24
|
+
|
|
16
25
|
Copyright.Icon = ({ children, ...rest }) => (
|
|
17
26
|
<span {...rest} className={'icon-wrapper'}>
|
|
18
27
|
{children}
|
|
@@ -49,6 +49,7 @@ const Edit = (props) => {
|
|
|
49
49
|
onSelectBlock,
|
|
50
50
|
} = props;
|
|
51
51
|
const { text, copyright, copyrightIcon, copyrightPosition } = data;
|
|
52
|
+
const copyrightPrefix = config.blocks.blocksConfig.hero.copyrightPrefix || '';
|
|
52
53
|
const schema = React.useMemo(() => {
|
|
53
54
|
const blockSchema = config.blocks.blocksConfig.hero.schema;
|
|
54
55
|
if (isFunction(blockSchema)) {
|
|
@@ -101,6 +102,7 @@ const Edit = (props) => {
|
|
|
101
102
|
</Hero.Meta>
|
|
102
103
|
{copyright ? (
|
|
103
104
|
<Copyright copyrightPosition={copyrightPosition}>
|
|
105
|
+
<Copyright.Prefix>{copyrightPrefix}</Copyright.Prefix>
|
|
104
106
|
<Copyright.Icon>
|
|
105
107
|
<Icon className={copyrightIcon} />
|
|
106
108
|
</Copyright.Icon>
|
|
@@ -3,7 +3,7 @@ import cx from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { isInternalURL } from '@plone/volto/helpers/Url/Url';
|
|
5
5
|
import { isImageGif } from '@eeacms/volto-hero-block/helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { useFirstVisited } from '@eeacms/volto-hero-block/hooks';
|
|
7
7
|
|
|
8
8
|
Hero.propTypes = {
|
|
9
9
|
image: PropTypes.string,
|
|
@@ -33,7 +33,7 @@ function Hero({
|
|
|
33
33
|
styles || {};
|
|
34
34
|
|
|
35
35
|
const bgImgRef = React.useRef();
|
|
36
|
-
const onScreen =
|
|
36
|
+
const onScreen = useFirstVisited(bgImgRef);
|
|
37
37
|
return (
|
|
38
38
|
<div
|
|
39
39
|
className={cx(
|
|
@@ -6,6 +6,7 @@ import { BodyClass } from '@plone/volto/helpers';
|
|
|
6
6
|
import Hero from './Hero';
|
|
7
7
|
import Copyright from './Copyright';
|
|
8
8
|
import { serializeText } from '@eeacms/volto-hero-block/helpers';
|
|
9
|
+
import config from '@plone/volto/registry';
|
|
9
10
|
|
|
10
11
|
const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
|
|
11
12
|
const { buttonVariant = 'white' } = styles || {};
|
|
@@ -25,6 +26,7 @@ const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
|
|
|
25
26
|
const View = (props) => {
|
|
26
27
|
const { data = {} } = props;
|
|
27
28
|
const { text, copyright, copyrightIcon, copyrightPosition } = data;
|
|
29
|
+
const copyrightPrefix = config.blocks.blocksConfig.hero.copyrightPrefix || '';
|
|
28
30
|
return (
|
|
29
31
|
<React.Fragment>
|
|
30
32
|
<BodyClass className="with-hero-block" />
|
|
@@ -35,6 +37,7 @@ const View = (props) => {
|
|
|
35
37
|
</Hero.Meta>
|
|
36
38
|
{copyright ? (
|
|
37
39
|
<Copyright copyrightPosition={copyrightPosition}>
|
|
40
|
+
<Copyright.Prefix>{copyrightPrefix}</Copyright.Prefix>
|
|
38
41
|
<Copyright.Icon>
|
|
39
42
|
<Icon className={copyrightIcon} />
|
|
40
43
|
</Copyright.Icon>
|
|
@@ -84,6 +84,18 @@ export default () => {
|
|
|
84
84
|
},
|
|
85
85
|
copyrightIcon: {
|
|
86
86
|
title: 'Icon',
|
|
87
|
+
description: (
|
|
88
|
+
<>
|
|
89
|
+
Ex. ri-copyright-line. See{' '}
|
|
90
|
+
<a
|
|
91
|
+
target="_blank"
|
|
92
|
+
rel="noopener noreferrer"
|
|
93
|
+
href="https://remixicon.com/"
|
|
94
|
+
>
|
|
95
|
+
Remix Icon set
|
|
96
|
+
</a>
|
|
97
|
+
</>
|
|
98
|
+
),
|
|
87
99
|
default: 'ri-copyright-line',
|
|
88
100
|
},
|
|
89
101
|
copyrightPosition: {
|
package/src/hooks.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
|
|
4
|
+
function useFirstVisited(ref, rootMargin = '0px') {
|
|
5
|
+
const [intersected, setIntersected] = React.useState(false);
|
|
7
6
|
React.useEffect(() => {
|
|
7
|
+
if (intersected) return;
|
|
8
8
|
const observer = new IntersectionObserver(
|
|
9
9
|
([entry]) => {
|
|
10
|
-
|
|
10
|
+
setIntersected(intersected === false ? entry.isIntersecting : true);
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
rootMargin,
|
|
@@ -24,8 +24,8 @@ function useOnScreen(ref, rootMargin = '0px') {
|
|
|
24
24
|
}
|
|
25
25
|
observer.disconnect();
|
|
26
26
|
};
|
|
27
|
-
}, [ref, rootMargin]);
|
|
28
|
-
return
|
|
27
|
+
}, [ref, rootMargin, intersected]);
|
|
28
|
+
return intersected;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export {
|
|
31
|
+
export { useFirstVisited };
|