@eeacms/volto-hero-block 7.1.0 → 9.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.
@@ -11,4 +11,122 @@ msgstr ""
11
11
  "Content-Transfer-Encoding: \n"
12
12
  "Plural-Forms: \n"
13
13
 
14
+ #. Default: "A short hint that describes the expected value within this block"
15
+ #: components/Blocks/Hero/LayoutSchema
16
+ msgid "A short hint that describes the expected value within this block"
17
+ msgstr ""
18
+
19
+ #. Default: "Allow only the following blocks types"
20
+ #: components/Blocks/Hero/LayoutSchema
21
+ msgid "Allow only the following blocks types"
22
+ msgstr ""
23
+
24
+ #. Default: "Default"
25
+ #: components/Blocks/Hero/LayoutSchema
26
+ msgid "Default"
27
+ msgstr ""
28
+
29
+ #. Default: "Detailed expected value within this block"
30
+ #: components/Blocks/Hero/LayoutSchema
31
+ msgid "Detailed expected value within this block"
32
+ msgstr ""
33
+
34
+ #. Default: "Disable creation of new blocks after this block"
35
+ #: components/Blocks/Hero/LayoutSchema
36
+ msgid "Disable creation of new blocks after this block"
37
+ msgstr ""
38
+
39
+ #. Default: "Disable drag & drop on this block"
40
+ #: components/Blocks/Hero/LayoutSchema
41
+ msgid "Disable drag & drop on this block"
42
+ msgstr ""
43
+
44
+ #. Default: "Disable editing on hero block settings"
45
+ #: components/Blocks/Hero/LayoutSchema
46
+ msgid "Disable editing on hero block settings"
47
+ msgstr ""
48
+
49
+ #. Default: "Disable editing on hero titles"
50
+ #: components/Blocks/Hero/LayoutSchema
51
+ msgid "Disable editing on hero titles"
52
+ msgstr ""
53
+
54
+ #. Default: "Disable editing on this block"
55
+ #: components/Blocks/Hero/LayoutSchema
56
+ msgid "Disable editing on this block"
57
+ msgstr ""
58
+
59
+ #. Default: "Disable inner buttons"
60
+ #: components/Blocks/Hero/LayoutSchema
61
+ msgid "Disable inner buttons"
62
+ msgstr ""
63
+
64
+ #. Default: "Disable new blocks"
65
+ #: components/Blocks/Hero/LayoutSchema
66
+ msgid "Disable new blocks"
67
+ msgstr ""
68
+
69
+ #. Default: "Don't allow deletion of this block"
70
+ #: components/Blocks/Hero/LayoutSchema
71
+ msgid "Don't allow deletion of this block"
72
+ msgstr ""
14
73
 
74
+ #. Default: "Fixed layout"
75
+ #: components/Blocks/Hero/LayoutSchema
76
+ msgid "Fixed layout"
77
+ msgstr ""
78
+
79
+ #. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
80
+ #: components/Blocks/Hero/LayoutSchema
81
+ msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
82
+ msgstr ""
83
+
84
+ #. Default: "Fixed position"
85
+ #: components/Blocks/Hero/LayoutSchema
86
+ msgid "Fixed position"
87
+ msgstr ""
88
+
89
+ #. Default: "Helper text"
90
+ #: components/Blocks/Hero/LayoutSchema
91
+ msgid "Helper text"
92
+ msgstr ""
93
+
94
+ #. Default: "Hero"
95
+ #: components/Blocks/Hero/index
96
+ msgid "Hero"
97
+ msgstr ""
98
+
99
+ #. Default: "Hero block settings"
100
+ #: components/Blocks/Hero/LayoutSchema
101
+ msgid "Hero block settings"
102
+ msgstr ""
103
+
104
+ #. Default: "Hide all block related buttons within this block"
105
+ #: components/Blocks/Hero/LayoutSchema
106
+ msgid "Hide all block related buttons within this block"
107
+ msgstr ""
108
+
109
+ #. Default: "Instructions"
110
+ #: components/Blocks/Hero/LayoutSchema
111
+ msgid "Instructions"
112
+ msgstr ""
113
+
114
+ #. Default: "Read-only"
115
+ #: components/Blocks/Hero/LayoutSchema
116
+ msgid "Read-only"
117
+ msgstr ""
118
+
119
+ #. Default: "Read-only settings"
120
+ #: components/Blocks/Hero/LayoutSchema
121
+ msgid "Read-only settings"
122
+ msgstr ""
123
+
124
+ #. Default: "Read-only titles"
125
+ #: components/Blocks/Hero/LayoutSchema
126
+ msgid "Read-only titles"
127
+ msgstr ""
128
+
129
+ #. Default: "Required"
130
+ #: components/Blocks/Hero/LayoutSchema
131
+ msgid "Required"
132
+ msgstr ""
@@ -11,4 +11,122 @@ msgstr ""
11
11
  "Content-Transfer-Encoding: \n"
12
12
  "Plural-Forms: \n"
13
13
 
14
+ #. Default: "A short hint that describes the expected value within this block"
15
+ #: components/Blocks/Hero/LayoutSchema
16
+ msgid "A short hint that describes the expected value within this block"
17
+ msgstr ""
18
+
19
+ #. Default: "Allow only the following blocks types"
20
+ #: components/Blocks/Hero/LayoutSchema
21
+ msgid "Allow only the following blocks types"
22
+ msgstr ""
23
+
24
+ #. Default: "Default"
25
+ #: components/Blocks/Hero/LayoutSchema
26
+ msgid "Default"
27
+ msgstr ""
28
+
29
+ #. Default: "Detailed expected value within this block"
30
+ #: components/Blocks/Hero/LayoutSchema
31
+ msgid "Detailed expected value within this block"
32
+ msgstr ""
33
+
34
+ #. Default: "Disable creation of new blocks after this block"
35
+ #: components/Blocks/Hero/LayoutSchema
36
+ msgid "Disable creation of new blocks after this block"
37
+ msgstr ""
38
+
39
+ #. Default: "Disable drag & drop on this block"
40
+ #: components/Blocks/Hero/LayoutSchema
41
+ msgid "Disable drag & drop on this block"
42
+ msgstr ""
43
+
44
+ #. Default: "Disable editing on hero block settings"
45
+ #: components/Blocks/Hero/LayoutSchema
46
+ msgid "Disable editing on hero block settings"
47
+ msgstr ""
48
+
49
+ #. Default: "Disable editing on hero titles"
50
+ #: components/Blocks/Hero/LayoutSchema
51
+ msgid "Disable editing on hero titles"
52
+ msgstr ""
53
+
54
+ #. Default: "Disable editing on this block"
55
+ #: components/Blocks/Hero/LayoutSchema
56
+ msgid "Disable editing on this block"
57
+ msgstr ""
58
+
59
+ #. Default: "Disable inner buttons"
60
+ #: components/Blocks/Hero/LayoutSchema
61
+ msgid "Disable inner buttons"
62
+ msgstr ""
63
+
64
+ #. Default: "Disable new blocks"
65
+ #: components/Blocks/Hero/LayoutSchema
66
+ msgid "Disable new blocks"
67
+ msgstr ""
68
+
69
+ #. Default: "Don't allow deletion of this block"
70
+ #: components/Blocks/Hero/LayoutSchema
71
+ msgid "Don't allow deletion of this block"
72
+ msgstr ""
14
73
 
74
+ #. Default: "Fixed layout"
75
+ #: components/Blocks/Hero/LayoutSchema
76
+ msgid "Fixed layout"
77
+ msgstr ""
78
+
79
+ #. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
80
+ #: components/Blocks/Hero/LayoutSchema
81
+ msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
82
+ msgstr ""
83
+
84
+ #. Default: "Fixed position"
85
+ #: components/Blocks/Hero/LayoutSchema
86
+ msgid "Fixed position"
87
+ msgstr ""
88
+
89
+ #. Default: "Helper text"
90
+ #: components/Blocks/Hero/LayoutSchema
91
+ msgid "Helper text"
92
+ msgstr ""
93
+
94
+ #. Default: "Hero"
95
+ #: components/Blocks/Hero/index
96
+ msgid "Hero"
97
+ msgstr ""
98
+
99
+ #. Default: "Hero block settings"
100
+ #: components/Blocks/Hero/LayoutSchema
101
+ msgid "Hero block settings"
102
+ msgstr ""
103
+
104
+ #. Default: "Hide all block related buttons within this block"
105
+ #: components/Blocks/Hero/LayoutSchema
106
+ msgid "Hide all block related buttons within this block"
107
+ msgstr ""
108
+
109
+ #. Default: "Instructions"
110
+ #: components/Blocks/Hero/LayoutSchema
111
+ msgid "Instructions"
112
+ msgstr ""
113
+
114
+ #. Default: "Read-only"
115
+ #: components/Blocks/Hero/LayoutSchema
116
+ msgid "Read-only"
117
+ msgstr ""
118
+
119
+ #. Default: "Read-only settings"
120
+ #: components/Blocks/Hero/LayoutSchema
121
+ msgid "Read-only settings"
122
+ msgstr ""
123
+
124
+ #. Default: "Read-only titles"
125
+ #: components/Blocks/Hero/LayoutSchema
126
+ msgid "Read-only titles"
127
+ msgstr ""
128
+
129
+ #. Default: "Required"
130
+ #: components/Blocks/Hero/LayoutSchema
131
+ msgid "Required"
132
+ msgstr ""
package/locales/volto.pot CHANGED
@@ -1,16 +1,134 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2023-06-28T10:48:22.678Z\n"
4
+ "POT-Creation-Date: 2026-03-10T22:13:14.190Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
- "MIME-Version: 1.0\n"
8
7
  "Content-Type: text/plain; charset=utf-8\n"
9
8
  "Content-Transfer-Encoding: 8bit\n"
10
9
  "Plural-Forms: nplurals=1; plural=0;\n"
10
+ "MIME-Version: 1.0\n"
11
11
  "Language-Code: en\n"
12
12
  "Language-Name: English\n"
13
13
  "Preferred-Encodings: utf-8\n"
14
14
  "Domain: volto\n"
15
15
 
16
+ #. Default: "A short hint that describes the expected value within this block"
17
+ #: components/Blocks/Hero/LayoutSchema
18
+ msgid "A short hint that describes the expected value within this block"
19
+ msgstr ""
20
+
21
+ #. Default: "Allow only the following blocks types"
22
+ #: components/Blocks/Hero/LayoutSchema
23
+ msgid "Allow only the following blocks types"
24
+ msgstr ""
25
+
26
+ #. Default: "Default"
27
+ #: components/Blocks/Hero/LayoutSchema
28
+ msgid "Default"
29
+ msgstr ""
30
+
31
+ #. Default: "Detailed expected value within this block"
32
+ #: components/Blocks/Hero/LayoutSchema
33
+ msgid "Detailed expected value within this block"
34
+ msgstr ""
35
+
36
+ #. Default: "Disable creation of new blocks after this block"
37
+ #: components/Blocks/Hero/LayoutSchema
38
+ msgid "Disable creation of new blocks after this block"
39
+ msgstr ""
40
+
41
+ #. Default: "Disable drag & drop on this block"
42
+ #: components/Blocks/Hero/LayoutSchema
43
+ msgid "Disable drag & drop on this block"
44
+ msgstr ""
45
+
46
+ #. Default: "Disable editing on hero block settings"
47
+ #: components/Blocks/Hero/LayoutSchema
48
+ msgid "Disable editing on hero block settings"
49
+ msgstr ""
50
+
51
+ #. Default: "Disable editing on hero titles"
52
+ #: components/Blocks/Hero/LayoutSchema
53
+ msgid "Disable editing on hero titles"
54
+ msgstr ""
55
+
56
+ #. Default: "Disable editing on this block"
57
+ #: components/Blocks/Hero/LayoutSchema
58
+ msgid "Disable editing on this block"
59
+ msgstr ""
60
+
61
+ #. Default: "Disable inner buttons"
62
+ #: components/Blocks/Hero/LayoutSchema
63
+ msgid "Disable inner buttons"
64
+ msgstr ""
65
+
66
+ #. Default: "Disable new blocks"
67
+ #: components/Blocks/Hero/LayoutSchema
68
+ msgid "Disable new blocks"
69
+ msgstr ""
70
+
71
+ #. Default: "Don't allow deletion of this block"
72
+ #: components/Blocks/Hero/LayoutSchema
73
+ msgid "Don't allow deletion of this block"
74
+ msgstr ""
75
+
76
+ #. Default: "Fixed layout"
77
+ #: components/Blocks/Hero/LayoutSchema
78
+ msgid "Fixed layout"
79
+ msgstr ""
80
+
81
+ #. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
82
+ #: components/Blocks/Hero/LayoutSchema
83
+ msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
84
+ msgstr ""
85
+
86
+ #. Default: "Fixed position"
87
+ #: components/Blocks/Hero/LayoutSchema
88
+ msgid "Fixed position"
89
+ msgstr ""
90
+
91
+ #. Default: "Helper text"
92
+ #: components/Blocks/Hero/LayoutSchema
93
+ msgid "Helper text"
94
+ msgstr ""
95
+
96
+ #. Default: "Hero"
97
+ #: components/Blocks/Hero/index
98
+ msgid "Hero"
99
+ msgstr ""
100
+
101
+ #. Default: "Hero block settings"
102
+ #: components/Blocks/Hero/LayoutSchema
103
+ msgid "Hero block settings"
104
+ msgstr ""
105
+
106
+ #. Default: "Hide all block related buttons within this block"
107
+ #: components/Blocks/Hero/LayoutSchema
108
+ msgid "Hide all block related buttons within this block"
109
+ msgstr ""
110
+
111
+ #. Default: "Instructions"
112
+ #: components/Blocks/Hero/LayoutSchema
113
+ msgid "Instructions"
114
+ msgstr ""
115
+
116
+ #. Default: "Read-only"
117
+ #: components/Blocks/Hero/LayoutSchema
118
+ msgid "Read-only"
119
+ msgstr ""
120
+
121
+ #. Default: "Read-only settings"
122
+ #: components/Blocks/Hero/LayoutSchema
123
+ msgid "Read-only settings"
124
+ msgstr ""
16
125
 
126
+ #. Default: "Read-only titles"
127
+ #: components/Blocks/Hero/LayoutSchema
128
+ msgid "Read-only titles"
129
+ msgstr ""
130
+
131
+ #. Default: "Required"
132
+ #: components/Blocks/Hero/LayoutSchema
133
+ msgid "Required"
134
+ msgstr ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "7.1.0",
3
+ "version": "9.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",
@@ -4,7 +4,7 @@ import { Icon } from 'semantic-ui-react';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import configureStore from 'redux-mock-store';
6
6
  import config from '@plone/volto/registry';
7
- import '@testing-library/jest-dom/extend-expect';
7
+ import '@testing-library/jest-dom';
8
8
 
9
9
  import Copyright from './Copyright';
10
10
 
@@ -4,7 +4,6 @@ import isFunction from 'lodash/isFunction';
4
4
  import { Icon } from 'semantic-ui-react';
5
5
  import config from '@plone/volto/registry';
6
6
  import { BlocksForm } from '@plone/volto/components';
7
- import EditBlockWrapper from '@plone/volto/components/manage/Blocks/Block/EditBlockWrapper';
8
7
  import { v4 as uuid } from 'uuid';
9
8
  import '@eeacms/volto-hero-block/components/Blocks/Hero/edit.css';
10
9
 
@@ -15,8 +14,7 @@ import {
15
14
  UniversalLink,
16
15
  } from '@plone/volto/components';
17
16
  import { BodyClass } from '@plone/volto/helpers';
18
-
19
- import { getFieldURL } from '@eeacms/volto-hero-block/helpers';
17
+ import { getFieldURL } from '@plone/volto/helpers/Url/Url';
20
18
  import { HeroBlockSchema } from './schema';
21
19
  import Copyright from './Copyright';
22
20
  import Hero from './Hero';
@@ -117,7 +115,7 @@ export default function Edit(props) {
117
115
  allowedBlocks={'slate'}
118
116
  selectedBlock={selectedBlock}
119
117
  title={data.placeholder}
120
- onSelectBlock={(s, e) => {
118
+ onSelectBlock={(s) => {
121
119
  setSelectedBlock(s);
122
120
  }}
123
121
  onChangeFormData={(newFormData) => {
@@ -141,17 +139,7 @@ export default function Edit(props) {
141
139
  }
142
140
  }}
143
141
  pathname={pathname}
144
- >
145
- {({ draginfo }, editBlock, blockProps) => (
146
- <EditBlockWrapper
147
- draginfo={draginfo}
148
- blockProps={blockProps}
149
- disabled={data.disableInnerButtons}
150
- >
151
- {editBlock}
152
- </EditBlockWrapper>
153
- )}
154
- </BlocksForm>
142
+ />
155
143
  </Hero.Text>
156
144
  <Hero.Meta {...data}>
157
145
  <Metadata {...data} />
@@ -1,21 +1,27 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import { Provider } from 'react-redux';
4
+ import { IntlProvider } from 'react-intl';
4
5
  import configureStore from 'redux-mock-store';
5
6
  import Edit from './Edit';
6
7
  import config from '@plone/volto/registry';
7
- import '@testing-library/jest-dom/extend-expect';
8
+ import '@testing-library/jest-dom';
9
+
10
+ // Mock uuid to avoid node:crypto import issues
11
+ jest.mock('uuid', () => ({
12
+ v4: () => 'mock-uuid-' + Math.random().toString(36).substr(2, 9),
13
+ }));
8
14
 
9
15
  const mockStore = configureStore([]);
10
16
  const observe = jest.fn();
11
17
  const unobserve = jest.fn();
18
+ const disconnect = jest.fn();
12
19
  jest.mock('@plone/volto/components', () => {
13
20
  return {
14
21
  __esModule: true,
15
- BlocksForm: ({ placeholder, children, onChange, onFocus }) => (
22
+ BlocksForm: ({ placeholder }) => (
16
23
  <div id="test">
17
24
  <div>{placeholder}</div>
18
- {children}
19
25
  </div>
20
26
  ),
21
27
  SidebarPortal: ({ children }) => <div>{children}</div>,
@@ -34,9 +40,10 @@ jest.mock('react-router-dom', () => ({
34
40
  }),
35
41
  }));
36
42
 
37
- window.IntersectionObserver = jest.fn((callback) => ({
43
+ window.IntersectionObserver = jest.fn(() => ({
38
44
  observe,
39
45
  unobserve,
46
+ disconnect,
40
47
  }));
41
48
 
42
49
  config.blocks = {
@@ -45,6 +52,7 @@ config.blocks = {
45
52
  copyrightPrefix: 'Test Prefix',
46
53
  schema: {
47
54
  title: 'Hero',
55
+ required: [],
48
56
  },
49
57
  },
50
58
  },
@@ -53,6 +61,7 @@ config.settings = {
53
61
  slate: {
54
62
  textblockExtensions: [],
55
63
  },
64
+ themeColors: [],
56
65
  };
57
66
 
58
67
  describe('Edit component', () => {
@@ -67,9 +76,11 @@ describe('Edit component', () => {
67
76
 
68
77
  it('renders without crashing', () => {
69
78
  const { container } = render(
70
- <Provider store={store}>
71
- <Edit onChangeBlock={() => {}} onSelectBlock={() => {}} />
72
- </Provider>,
79
+ <IntlProvider locale="en" messages={{}}>
80
+ <Provider store={store}>
81
+ <Edit onChangeBlock={() => {}} onSelectBlock={() => {}} />
82
+ </Provider>
83
+ </IntlProvider>,
73
84
  );
74
85
  expect(container).toBeTruthy();
75
86
  });
@@ -89,9 +100,11 @@ describe('Edit component', () => {
89
100
  };
90
101
 
91
102
  const { container } = render(
92
- <Provider store={store}>
93
- <Edit data={data} onChangeBlock={() => {}} />
94
- </Provider>,
103
+ <IntlProvider locale="en" messages={{}}>
104
+ <Provider store={store}>
105
+ <Edit data={data} onChangeBlock={() => {}} />
106
+ </Provider>
107
+ </IntlProvider>,
95
108
  );
96
109
 
97
110
  expect(container.querySelector('#test')).toBeInTheDocument();
@@ -103,15 +116,18 @@ describe('Edit component', () => {
103
116
  hero: {
104
117
  schema: () => ({
105
118
  title: 'Hero',
119
+ required: [],
106
120
  }),
107
121
  },
108
122
  },
109
123
  };
110
124
  const onSelectBlock = jest.fn();
111
125
  render(
112
- <Provider store={store}>
113
- <Edit onSelectBlock={onSelectBlock} onChangeBlock={() => {}} />
114
- </Provider>,
126
+ <IntlProvider locale="en" messages={{}}>
127
+ <Provider store={store}>
128
+ <Edit onSelectBlock={onSelectBlock} onChangeBlock={() => {}} />
129
+ </Provider>
130
+ </IntlProvider>,
115
131
  );
116
132
  });
117
133
  });
@@ -1,12 +1,11 @@
1
- import React from 'react';
1
+ import React, { useMemo, useRef } from 'react';
2
2
  import cx from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
- import { isInternalURL } from '@plone/volto/helpers/Url/Url';
5
- import { isImageGif, getFieldURL } from '@eeacms/volto-hero-block/helpers';
4
+ import { getImageScaleParams } from '@eeacms/volto-object-widget/helpers';
6
5
  import { useFirstVisited } from '@eeacms/volto-hero-block/hooks';
7
6
 
8
7
  Hero.propTypes = {
9
- image: PropTypes.string,
8
+ image: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
10
9
  fullWidth: PropTypes.bool,
11
10
  fullHeight: PropTypes.bool,
12
11
  alignContent: PropTypes.string,
@@ -18,46 +17,48 @@ Hero.propTypes = {
18
17
  textVariant: PropTypes.string,
19
18
  };
20
19
 
21
- function Hero({
22
- overlay = true,
23
- fullWidth = true,
24
- fullHeight = true,
25
- children,
26
- spaced = false,
27
- inverted = true,
28
- styles,
29
- height,
30
- ...props
31
- }) {
32
- const image = getFieldURL(props.image);
33
- const isExternal = !isInternalURL(image);
20
+ function Hero(props) {
21
+ const {
22
+ image,
23
+ fullWidth = false,
24
+ fullHeight = false,
25
+ height,
26
+ styles,
27
+ overlay = true,
28
+ children,
29
+ spaced = false,
30
+ inverted = false,
31
+ } = props;
32
+
33
+ const scaledImage = useMemo(
34
+ () => (image ? getImageScaleParams(image, 'huge') : null),
35
+ [image],
36
+ );
34
37
  const { alignContent = 'center', backgroundVariant = 'primary' } =
35
38
  styles || {};
36
- const bgImgRef = React.useRef();
39
+ const bgImgRef = useRef();
37
40
  const onScreen = useFirstVisited(bgImgRef);
38
- const containerCssStyles = React.useMemo(
41
+ const containerCssStyles = useMemo(
39
42
  () => ({
40
43
  ...(height && !fullHeight ? { height } : {}),
41
44
  }),
42
45
  [height, fullHeight],
43
46
  );
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
- : {};
47
+ const backgroundImageStyle = useMemo(
48
+ () =>
49
+ onScreen && scaledImage
50
+ ? {
51
+ backgroundImage: `url(${scaledImage.download})`,
52
+ }
53
+ : {},
54
+ [onScreen, scaledImage],
55
+ );
55
56
 
56
57
  return (
57
58
  <div
58
59
  className={cx(
59
60
  'eea hero-block',
60
- !image &&
61
+ !scaledImage &&
61
62
  backgroundVariant &&
62
63
  !fullWidth &&
63
64
  `color-bg-${backgroundVariant}`,
@@ -71,7 +72,7 @@ function Hero({
71
72
  <div
72
73
  className={cx(
73
74
  'hero-block-image-wrapper',
74
- !image &&
75
+ !scaledImage &&
75
76
  backgroundVariant &&
76
77
  fullWidth &&
77
78
  `color-bg-${backgroundVariant}`,
@@ -86,7 +87,7 @@ function Hero({
86
87
  ref={bgImgRef}
87
88
  style={backgroundImageStyle}
88
89
  />
89
- {image && overlay && (
90
+ {scaledImage && overlay && (
90
91
  <div className="hero-block-image-overlay dark-overlay-4"></div>
91
92
  )}
92
93
  </div>