@eeacms/volto-hero-block 7.0.1 → 7.1.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,25 @@ 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
+ ### [7.1.0](https://github.com/eea/volto-hero-block/compare/7.0.1...7.1.0) - 28 June 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(hero): default values for non boolean are set by default not defaultValue [David Ichim - [`608ec21`](https://github.com/eea/volto-hero-block/commit/608ec21f6a3c14ee0b5ec3dc6864650adc0c83bc)]
12
+
13
+ #### :nail_care: Enhancements
14
+
15
+ - change(hero): cache containerCssStyles and use it only on top level [David Ichim - [`cd666c8`](https://github.com/eea/volto-hero-block/commit/cd666c86d80d17a1acaca68fd37778976cbb607e)]
16
+
17
+ #### :house: Internal changes
18
+
19
+ - chore: package.json [alin - [`516b46f`](https://github.com/eea/volto-hero-block/commit/516b46fc82000ac4ccb4d08c6a71acd4c548385b)]
20
+
21
+ #### :hammer_and_wrench: Others
22
+
23
+ - Added back style to the divs as required by the other developers [David Ichim - [`56c6156`](https://github.com/eea/volto-hero-block/commit/56c61566a6338a0147ab7c439b21e7120d2e88e9)]
24
+ - bump package version to 7.1.0 [David Ichim - [`9f4cf35`](https://github.com/eea/volto-hero-block/commit/9f4cf3571205c578aaefcb6ffc6779e3d557f07f)]
25
+ - add height property [dorutrip - [`86b0f13`](https://github.com/eea/volto-hero-block/commit/86b0f13034d7ee3a2c21b5865250af8c5a39b3cc)]
7
26
  ### [7.0.1](https://github.com/eea/volto-hero-block/compare/7.0.0...7.0.1) - 13 May 2024
8
27
 
9
28
  #### :bug: Bug Fixes
@@ -20,7 +39,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
20
39
 
21
40
  #### :hammer_and_wrench: Others
22
41
 
23
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`462fff7`](https://github.com/eea/volto-hero-block/commit/462fff7cc0d1898d17a73e4e4e38057642042524)]
24
42
  ### [6.0.1](https://github.com/eea/volto-hero-block/compare/6.0.0...6.0.1) - 5 April 2024
25
43
 
26
44
  #### :house: Internal changes
@@ -77,7 +95,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
77
95
  - Allow multiline editing of hero block [Tiberiu Ichim - [`373d1a0`](https://github.com/eea/volto-hero-block/commit/373d1a0d243b8e0b3df31f2a51a3c5df62f48214)]
78
96
  - Allow multiline editing of hero block [Tiberiu Ichim - [`b674ca5`](https://github.com/eea/volto-hero-block/commit/b674ca589502a81aaf6abed75dbf8b83ac1731fb)]
79
97
  - fix ESlint [Teodor - [`1439495`](https://github.com/eea/volto-hero-block/commit/14394952ef587f71be8b2c762c7e19698d8a55e4)]
80
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`f133e20`](https://github.com/eea/volto-hero-block/commit/f133e2017ff9c3f13e6c44ce3e6b7757a25b129f)]
81
98
  - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`de6a206`](https://github.com/eea/volto-hero-block/commit/de6a206bed9afd53d97f5e6d70e2391ccc01f0f1)]
82
99
  ### [5.4.6](https://github.com/eea/volto-hero-block/compare/5.4.5...5.4.6) - 27 November 2023
83
100
 
@@ -91,16 +108,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
91
108
 
92
109
  #### :house: Internal changes
93
110
 
94
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`df8242c`](https://github.com/eea/volto-hero-block/commit/df8242c62eb8c706c3854f6bb4a6984932463571)]
95
111
 
96
112
  #### :hammer_and_wrench: Others
97
113
 
98
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`4ea90f6`](https://github.com/eea/volto-hero-block/commit/4ea90f6a23c92fe631ee6025dbe5ee27ec030665)]
99
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`6e9d7f5`](https://github.com/eea/volto-hero-block/commit/6e9d7f593363e08f519ab8296aef229ed2682113)]
100
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`067fa27`](https://github.com/eea/volto-hero-block/commit/067fa27ee26d1d348d5ce1b089ea9931d9f32589)]
101
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`0f6a259`](https://github.com/eea/volto-hero-block/commit/0f6a259fc73db97a7a8af69a808421191b146629)]
102
- - test: [JENKINS] Improve cypress time [valentinab25 - [`c1c72f4`](https://github.com/eea/volto-hero-block/commit/c1c72f4b54a84521f200682b230bba60e6920a70)]
103
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`65744c9`](https://github.com/eea/volto-hero-block/commit/65744c9b2b0944d2aff90fc56485f10390810d1c)]
104
114
  ### [5.4.5](https://github.com/eea/volto-hero-block/compare/5.4.4...5.4.5) - 19 October 2023
105
115
 
106
116
  ### [5.4.4](https://github.com/eea/volto-hero-block/compare/5.4.3...5.4.4) - 19 October 2023
@@ -140,14 +150,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
140
150
  - test: add unit tests for Hero, Edit, helpers, hooks - refs #254313 [ana-oprea - [`89b39af`](https://github.com/eea/volto-hero-block/commit/89b39afe7ad5ce94d341482be91ab55e2c1a31ed)]
141
151
  - i18n: Add en [Alin Voinea - [`9cdb7f1`](https://github.com/eea/volto-hero-block/commit/9cdb7f1ff9d81dade3d91551b53cf7200f08937e)]
142
152
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`0fe0d91`](https://github.com/eea/volto-hero-block/commit/0fe0d91fe9c43d10574990e9b163ffc49fe5bee7)]
143
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`b1d1446`](https://github.com/eea/volto-hero-block/commit/b1d14467bcde28023b2831235928db1f328d6b0a)]
144
153
  ### [5.4.1](https://github.com/eea/volto-hero-block/compare/5.4.0...5.4.1) - 24 July 2023
145
154
 
146
155
  ### [5.4.0](https://github.com/eea/volto-hero-block/compare/5.3.1...5.4.0) - 12 June 2023
147
156
 
148
157
  #### :house: Internal changes
149
158
 
150
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`395db48`](https://github.com/eea/volto-hero-block/commit/395db484f73c2dd2c56233c120a9620340f17d0b)]
151
159
 
152
160
  #### :hammer_and_wrench: Others
153
161
 
@@ -168,7 +176,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
168
176
  - put return statement [Dobricean Ioan Dorian - [`8eff5fd`](https://github.com/eea/volto-hero-block/commit/8eff5fdf977fcbb8cc952d3f45b577b02ca59cb9)]
169
177
  - change name and refactor to be more efficent [Dobricean Ioan Dorian - [`ff24145`](https://github.com/eea/volto-hero-block/commit/ff2414542833998ef282376de3fbda8698287849)]
170
178
  - stop-image-disappear over and over [Dobricean Ioan Dorian - [`c5b6f54`](https://github.com/eea/volto-hero-block/commit/c5b6f545ac422d95b8d802349aa4cf27af820829)]
171
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`3d38dd0`](https://github.com/eea/volto-hero-block/commit/3d38dd09a36525bda448f67a6d218bc7690a4cc3)]
172
179
  ### [5.3.0](https://github.com/eea/volto-hero-block/compare/5.2.0...5.3.0) - 27 March 2023
173
180
 
174
181
  #### :rocket: New Features
@@ -207,11 +214,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
207
214
  - fix onScreen hook error #16 from eea/fix-onscreen-hook [ichim-david - [`9123541`](https://github.com/eea/volto-hero-block/commit/91235413f423d7e6c4788d70b687b3ed5d4884b4)]
208
215
  - no need for comments [andreiggr - [`a14f9c3`](https://github.com/eea/volto-hero-block/commit/a14f9c3bdddfa22e6b4bbc8318f0ca5bdc9c2d38)]
209
216
  - fix hook [andreiggr - [`f7fae73`](https://github.com/eea/volto-hero-block/commit/f7fae73007f79af2f06da1d9b72a53ad86fef4ac)]
210
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6b78fc0`](https://github.com/eea/volto-hero-block/commit/6b78fc044a933ab9b4b4694901aa26628ef0a836)]
211
217
  - eslint [andreiggr - [`68451b7`](https://github.com/eea/volto-hero-block/commit/68451b725420015fbd5b695e97b8742988d49913)]
212
218
  - lazy load huge img on first 10px [andreiggr - [`67dc7d3`](https://github.com/eea/volto-hero-block/commit/67dc7d3475188d692e053032c2639dd1a585c029)]
213
219
  - lazy load huge bgimage wip [andreiggr - [`86e45ec`](https://github.com/eea/volto-hero-block/commit/86e45ece842f1cd7452920dffa3a9b4aea945f56)]
214
- - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`87cbb38`](https://github.com/eea/volto-hero-block/commit/87cbb383290a168f85703573670e17f4e1ed7747)]
215
220
  ## [4.0.0](https://github.com/eea/volto-hero-block/compare/3.0.1...4.0.0) - 7 February 2023
216
221
 
217
222
  #### :nail_care: Enhancements
@@ -237,7 +242,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
237
242
 
238
243
  #### :hammer_and_wrench: Others
239
244
 
240
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`ab85c7b`](https://github.com/eea/volto-hero-block/commit/ab85c7bd5bd1e3aec95e02f9b4d026b1203d5739)]
241
245
  ## [3.0.0](https://github.com/eea/volto-hero-block/compare/2.1.0...3.0.0) - 22 December 2022
242
246
 
243
247
  #### :rocket: New Features
@@ -246,11 +250,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
246
250
 
247
251
  #### :hammer_and_wrench: Others
248
252
 
249
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f06f58c`](https://github.com/eea/volto-hero-block/commit/f06f58c7cd4cfc15a03208e9c7a4e31fe2eba2f6)]
250
- - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`20e5bcb`](https://github.com/eea/volto-hero-block/commit/20e5bcb3c4dd538595741928319c3204c5d18f8c)]
251
253
  - Cosmetics [Alin Voinea - [`9dac70c`](https://github.com/eea/volto-hero-block/commit/9dac70c0a3bea8e188ede9123f4f99de8e0f6987)]
252
254
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`2d4005f`](https://github.com/eea/volto-hero-block/commit/2d4005f0f31b121e1b7d2e94414f3dff92ec1a16)]
253
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`2931fcc`](https://github.com/eea/volto-hero-block/commit/2931fccbee5f8e117e5ae9095ba57e63e465ddb3)]
254
255
  ### [2.1.0](https://github.com/eea/volto-hero-block/compare/2.0.0...2.1.0) - 12 December 2022
255
256
 
256
257
  #### :bug: Bug Fixes
@@ -259,12 +260,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
259
260
 
260
261
  #### :hammer_and_wrench: Others
261
262
 
262
- - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`93be4f9`](https://github.com/eea/volto-hero-block/commit/93be4f96fb72cacfc25f9b058cb379d80060ee13)]
263
- - yarn 3 [Alin Voinea - [`8e2dccd`](https://github.com/eea/volto-hero-block/commit/8e2dccd47cbef3c0871407baa376ce61c540c754)]
264
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`6bc3af3`](https://github.com/eea/volto-hero-block/commit/6bc3af35b4edf07971d1b0ce1648965e8d6e3bc0)]
265
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`d7dbbd2`](https://github.com/eea/volto-hero-block/commit/d7dbbd21277dd76bf59d91a4dc8e022b2a6ff99c)]
266
- - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`3c1f0d6`](https://github.com/eea/volto-hero-block/commit/3c1f0d6e7f8e5318aee3413ec3687d8492376f9d)]
267
- - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`843017a`](https://github.com/eea/volto-hero-block/commit/843017aa7dbea71cc7888663496e352d287440b4)]
268
263
  ## [2.0.0](https://github.com/eea/volto-hero-block/compare/1.0.0...2.0.0) - 16 November 2022
269
264
 
270
265
  #### :nail_care: Enhancements
@@ -274,7 +269,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
274
269
  #### :hammer_and_wrench: Others
275
270
 
276
271
  - test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`b8f0971`](https://github.com/eea/volto-hero-block/commit/b8f0971b21a5334d40c1b8f5103cea61d9ffe6f1)]
277
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`581dedf`](https://github.com/eea/volto-hero-block/commit/581dedf07410ef2ca09e6ddaa05fbf176400adbb)]
278
272
  ## [1.0.0](https://github.com/eea/volto-hero-block/compare/0.2.0...1.0.0) - 28 October 2022
279
273
 
280
274
  #### :nail_care: Enhancements
@@ -286,7 +280,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
286
280
  - Remove cypress.json [Alin Voinea - [`593bdf2`](https://github.com/eea/volto-hero-block/commit/593bdf207ca4fd3f2393117b6f64a44727881ad0)]
287
281
  - test(cypress): Upgrade to Cypress 10 / Razzle 4 [Alin Voinea - [`edd48a5`](https://github.com/eea/volto-hero-block/commit/edd48a5c13824bce5e03e46790f1890656b340d8)]
288
282
  - Cleanup [Alin Voinea - [`9d72ee7`](https://github.com/eea/volto-hero-block/commit/9d72ee7a06d1c6fed46586d30bb85eae39e670bf)]
289
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`95986d0`](https://github.com/eea/volto-hero-block/commit/95986d0b8fd5c3cbb9e6da9059f71e066a8e171b)]
290
283
  ### [0.2.0](https://github.com/eea/volto-hero-block/compare/0.1.4...0.2.0) - 6 July 2022
291
284
 
292
285
  #### :bug: Bug Fixes
@@ -325,7 +318,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
325
318
  - Update slate footnote support [Miu Razvan - [`c1522b4`](https://github.com/eea/volto-hero-block/commit/c1522b4164dbe6de01771d211d7e0bf3009f44d4)]
326
319
  - Use justify content for text and button as well [Miu Razvan - [`08599cc`](https://github.com/eea/volto-hero-block/commit/08599cc45546d9b349128c4f8ce9c01318385811)]
327
320
  - Add dependencies [Miu Razvan - [`30e2881`](https://github.com/eea/volto-hero-block/commit/30e2881a2a97a899e7f4cc614a0405c300ac6fee)]
328
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b415422`](https://github.com/eea/volto-hero-block/commit/b41542285edd29440a324b101a4dbae9334830bf)]
329
321
  ### 0.1.0 - 10 June 2022
330
322
 
331
323
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "7.0.1",
3
+ "version": "7.1.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",
@@ -24,10 +24,10 @@
24
24
  "@eeacms/volto-widget-theme-picker": "*"
25
25
  },
26
26
  "devDependencies": {
27
- "cypress": "13.1.0",
28
27
  "@cypress/code-coverage": "^3.10.0",
29
28
  "@plone/scripts": "*",
30
29
  "babel-plugin-transform-class-properties": "^6.24.1",
30
+ "cypress": "13.1.0",
31
31
  "dotenv": "^16.3.2",
32
32
  "husky": "^8.0.3",
33
33
  "lint-staged": "^14.0.1",
@@ -26,15 +26,32 @@ function Hero({
26
26
  spaced = false,
27
27
  inverted = true,
28
28
  styles,
29
+ height,
29
30
  ...props
30
31
  }) {
31
32
  const image = getFieldURL(props.image);
32
33
  const isExternal = !isInternalURL(image);
33
34
  const { alignContent = 'center', backgroundVariant = 'primary' } =
34
35
  styles || {};
35
-
36
36
  const bgImgRef = React.useRef();
37
37
  const onScreen = useFirstVisited(bgImgRef);
38
+ const containerCssStyles = React.useMemo(
39
+ () => ({
40
+ ...(height && !fullHeight ? { height } : {}),
41
+ }),
42
+ [height, fullHeight],
43
+ );
44
+
45
+ const backgroundImageStyle =
46
+ onScreen && image
47
+ ? {
48
+ backgroundImage: isExternal
49
+ ? `url(${image})`
50
+ : isImageGif(image)
51
+ ? `url(${image}/@@images/image)`
52
+ : `url(${image}/@@images/image/huge)`,
53
+ }
54
+ : {};
38
55
 
39
56
  return (
40
57
  <div
@@ -62,21 +79,12 @@ function Hero({
62
79
  'full-width': fullWidth,
63
80
  },
64
81
  )}
82
+ style={containerCssStyles}
65
83
  >
66
84
  <div
67
85
  className={cx('hero-block-image', styles?.bg)}
68
86
  ref={bgImgRef}
69
- style={
70
- image && onScreen
71
- ? {
72
- backgroundImage: isExternal
73
- ? `url(${image})`
74
- : isImageGif(image)
75
- ? `url(${image}/@@images/image)`
76
- : `url(${image}/@@images/image/huge)`,
77
- }
78
- : {}
79
- }
87
+ style={backgroundImageStyle}
80
88
  />
81
89
  {image && overlay && (
82
90
  <div className="hero-block-image-overlay dark-overlay-4"></div>
@@ -87,6 +95,7 @@ function Hero({
87
95
  'hero-block-inner-wrapper d-flex',
88
96
  `flex-items-${alignContent}`,
89
97
  )}
98
+ style={containerCssStyles}
90
99
  >
91
100
  <div className="hero-block-body">{children}</div>
92
101
  </div>
@@ -13,7 +13,7 @@ const ALIGN_INFO_MAP = {
13
13
  '': [clearSVG, 'None'],
14
14
  };
15
15
 
16
- export const HeroBlockSchema = () => {
16
+ export const HeroBlockSchema = ({ data }) => {
17
17
  return {
18
18
  title: 'Hero',
19
19
  fieldsets: [
@@ -23,6 +23,7 @@ export const HeroBlockSchema = () => {
23
23
  fields: [
24
24
  'fullWidth',
25
25
  'fullHeight',
26
+ ...(!data?.fullHeight ? ['height'] : []),
26
27
  'quoted',
27
28
  'spaced',
28
29
  'inverted',
@@ -100,7 +101,13 @@ export const HeroBlockSchema = () => {
100
101
  title: 'Align',
101
102
  widget: 'align',
102
103
  actions: ['left', 'right'],
103
- defaultValue: 'left',
104
+ default: 'left',
105
+ },
106
+ height: {
107
+ title: 'Height',
108
+ description:
109
+ 'Use CSS numeric dimmension (ex: 100px or 20vh). ' +
110
+ 'Images cannnot be made smaller than min-height.',
104
111
  },
105
112
  },
106
113
  required: [],
@@ -133,7 +140,7 @@ export const stylingSchema = (props) => {
133
140
  widget: 'align',
134
141
  actions: Object.keys(ALIGN_INFO_MAP),
135
142
  actionsInfoMap: ALIGN_INFO_MAP,
136
- defaultValue: 'has--bg--center',
143
+ default: 'has--bg--center',
137
144
  },
138
145
  backgroundVariant: {
139
146
  title: 'Background theme',
@@ -155,12 +162,13 @@ export const stylingSchema = (props) => {
155
162
  ['center', 'Center'],
156
163
  ['end', 'Bottom'],
157
164
  ],
165
+ default: 'center',
158
166
  },
159
167
  textAlign: {
160
168
  title: 'Text align',
161
169
  widget: 'align',
162
170
  actions: ['left', 'center', 'right'],
163
- defaultValue: 'left',
171
+ default: 'left',
164
172
  },
165
173
  textVariant: {
166
174
  title: 'Text theme',
@@ -192,7 +200,7 @@ export const stylingSchema = (props) => {
192
200
  title: 'Button align',
193
201
  widget: 'align',
194
202
  actions: ['left', 'center', 'right'],
195
- defaultValue: 'left',
203
+ default: 'left',
196
204
  },
197
205
  },
198
206
  required: [],