diff --git a/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx b/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx index 1bd3f0819..950c6feee 100644 --- a/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx +++ b/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx @@ -10,8 +10,6 @@ import { } from 'design-comuni-plone-theme/components/ItaliaTheme'; import React, { useRef, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; - -import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg'; import { GalleryPreview } from 'design-comuni-plone-theme/components/ItaliaTheme'; import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; import PropTypes from 'prop-types'; @@ -139,12 +137,14 @@ const PhotogalleryTemplate = ({ const getCaption = (item) => item.description ?? item.rights ?? null; - const figure = (image, item) => ( -
- {image ? <>{image} : } - {getCaption(item) &&
{getCaption(item)}
} -
- ); + const figure = (image, item) => { + return ( +
+ {image} + {getCaption(item) &&
{getCaption(item)}
} +
+ ); + }; return (
diff --git a/src/components/ItaliaTheme/GalleryPreview/GalleryPreview.jsx b/src/components/ItaliaTheme/GalleryPreview/GalleryPreview.jsx index 78a950fd0..a6a618578 100644 --- a/src/components/ItaliaTheme/GalleryPreview/GalleryPreview.jsx +++ b/src/components/ItaliaTheme/GalleryPreview/GalleryPreview.jsx @@ -3,7 +3,6 @@ import { defineMessages, useIntl } from 'react-intl'; import { flattenToAppURL } from '@plone/volto/helpers'; import PropTypes from 'prop-types'; - import { Modal, ModalBody, Button, ModalHeader } from 'design-react-kit'; import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg'; @@ -34,6 +33,10 @@ const GalleryPreview = ({ id, viewIndex, setViewIndex, items }) => { const intl = useIntl(); const [modalIsOpen, setModalIsOpen] = useState(false); + const checkUrlImage = + items[viewIndex]?.image?.scales?.larger?.download || + items[viewIndex]?.image_scales?.image[0]?.scales?.larger?.download; + const closeModal = () => { setViewIndex(null); }; @@ -92,11 +95,9 @@ const GalleryPreview = ({ id, viewIndex, setViewIndex, items }) => { )}
- {items[viewIndex].image ? ( + {checkUrlImage ? ( {items[viewIndex].title}