Skip to content

Commit

Permalink
fix: use Image instead PreviewImage in ListingImage
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Sep 13, 2023
1 parent a809acc commit 41bf910
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"@babel/plugin-proposal-throw-expressions": "7.18.6",
"@loadable/babel-plugin": "5.13.2",
"@plone-collective/volto-sentry": "0.3.0",
"@plone/volto": "git+ssh://[email protected]:plone/volto.git#fix_preview_image",
"@plone/volto": "17.0.0-alpha.25",
"@storybook/addon-actions": "^6.5.15",
"@storybook/addon-controls": "6.5.15",
"@storybook/addon-essentials": "^6.5.15",
Expand Down
16 changes: 10 additions & 6 deletions src/components/ItaliaTheme/Blocks/Listing/Commons/ListingImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ const ListingImage = ({
sizes = '(max-width:320px) 200px, (max-width:425px) 300px, (max-width:768px) 400px, 300px',
...imageProps
}) => {
const PreviewImage = config.getComponent({ name: 'PreviewImage' }).component;
const Image = config.getComponent({ name: 'Image' }).component;

return (
<PreviewImage
const image = (
<Image
aria-hidden="true"
alt=""
role="presentation"
className={className}
item={{
...item,
image_field: 'image', //[ToDo]: rimuove image_field quando cekk ritorna i dati corretti per i listing
image: { ...item.image, download: item.image?.scales?.huge?.download }, //[ToDo]: rimuove image_field quando cekk ritorna i dati corretti per i listing
}}
loading={loading}
aria-hidden="true"
alt=""
title={item.title}
responsive={responsive}
sizes={sizes}
role="presentation"
{...imageProps}
/>
);

if (!image) return null;

return image;
};

export const getListingImageBackground = (item, size) => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4390,9 +4390,9 @@ __metadata:
languageName: node
linkType: hard

"@plone/volto@git+ssh://[email protected]:plone/volto.git#fix_preview_image":
"@plone/volto@npm:17.0.0-alpha.25":
version: 17.0.0-alpha.25
resolution: "@plone/volto@git+ssh://[email protected]:plone/volto.git#commit=aa259a087a9c2bbaa1664600aedf306e66aea2e0"
resolution: "@plone/volto@npm:17.0.0-alpha.25"
dependencies:
"@babel/core": ^7.0.0
"@babel/plugin-proposal-export-default-from": 7.18.9
Expand Down Expand Up @@ -4572,7 +4572,7 @@ __metadata:
webpack-node-externals: 3.0.0
xmlrpc: 1.3.2
yarnhook: 0.5.1
checksum: 1d12cf2917cda518e010f2fb141b5dfd502ee29dbc45886afef64452587c995ea6b9e4143bf88bedc5ee091b8895152d526e53b086990c299d1163e3df2004ef
checksum: 72b7c7676878bd8543e1102de927bf945ca6f8ebcfaa79af76f9dad266c2f94fd8760c8a3986b2c45bd20d37686140ee533028c6adb17e4c7669cadc07e44f34
languageName: node
linkType: hard

Expand Down Expand Up @@ -12187,7 +12187,7 @@ __metadata:
"@loadable/babel-plugin": 5.13.2
"@plone-collective/volto-sentry": 0.3.0
"@plone/scripts": ^3.0.0
"@plone/volto": "git+ssh://[email protected]:plone/volto.git#fix_preview_image"
"@plone/volto": 17.0.0-alpha.25
"@release-it/conventional-changelog": ^2.0.1
"@storybook/addon-actions": ^6.5.15
"@storybook/addon-controls": 6.5.15
Expand Down

0 comments on commit 41bf910

Please sign in to comment.