From c1bbdb998a145c608e0fc8da5d23223ddaa0ac12 Mon Sep 17 00:00:00 2001 From: sabrina-bongiovanni <116291154+sabrina-bongiovanni@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:56:21 +0200 Subject: [PATCH] fix: slider styles + arrows in ct gallery (#764) Co-authored-by: Piero Nicolli --- RELEASE.md | 5 +- .../ItaliaTheme/View/Commons/Gallery.jsx | 63 ++++++++++--------- src/theme/ItaliaTheme/Views/_common.scss | 27 ++++++++ 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index d84a3bc2a..c40b228ef 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -45,15 +45,14 @@ ### Migliorie -- ... +- Migliorato il layout della galleria immagini nei CT. ### Novità -- Aggiunto campo per l'inserimento del titolo e della descrizione nel blocco accordion +- Aggiunto campo per l'inserimento del titolo e della descrizione nel blocco Accordion. ### Fix -- ... - Rimosso il campo "ID lighthouse" dal blocco elenco con variazione Card con Testo Animato perchè entra in contrasto con asseveratore. Pianificato evento per ripristinarlo. ## Versione 11.22.0 (05/09/2024) diff --git a/src/components/ItaliaTheme/View/Commons/Gallery.jsx b/src/components/ItaliaTheme/View/Commons/Gallery.jsx index 788ea3b83..0c07644c3 100644 --- a/src/components/ItaliaTheme/View/Commons/Gallery.jsx +++ b/src/components/ItaliaTheme/View/Commons/Gallery.jsx @@ -13,6 +13,7 @@ import { SingleSlideWrapper, CarouselWrapper, } from 'design-comuni-plone-theme/components/ItaliaTheme'; +import { useSlider } from 'design-comuni-plone-theme/components/ItaliaTheme/Slider/slider'; import PropTypes from 'prop-types'; import { contentFolderHasItems } from 'design-comuni-plone-theme/helpers'; import { UniversalLink } from '@plone/volto/components'; @@ -50,6 +51,7 @@ const Gallery = ({ reactSlick, }) => { const Slider = reactSlick.default; + const { SliderNextArrow, SliderPrevArrow } = useSlider(); const Image = config.getComponent({ name: 'Image' }).component; const getSettings = (nItems, slideToScroll) => { return { @@ -58,6 +60,8 @@ const Gallery = ({ speed: 500, slidesToShow: nItems < 3 ? nItems : 3, slidesToScroll: slideToScroll ?? 3, + nextArrow: , + prevArrow: , responsive: [ { breakpoint: 1024, @@ -154,37 +158,40 @@ const Gallery = ({ {images.map((item, i) => ( -
- { - e.preventDefault(); - e.stopPropagation(); - setViewImageIndex(i); - }} - onKeyDown={(e) => { - if (e.keyCode === 13) { +
+
+ { e.preventDefault(); e.stopPropagation(); setViewImageIndex(i); - } - }} - aria-label={`${intl.formatMessage( - messages.viewPreview, - )} ${item.title}`} - > - {item.title} - -
- {item.title} -
-
+ }} + onKeyDown={(e) => { + if (e.keyCode === 13) { + e.preventDefault(); + e.stopPropagation(); + setViewImageIndex(i); + } + }} + aria-label={`${intl.formatMessage( + messages.viewPreview, + )} ${item.title}`} + className="img-wrapper" + > + {item.title} + +
+ {item.title} +
+
+
))}
diff --git a/src/theme/ItaliaTheme/Views/_common.scss b/src/theme/ItaliaTheme/Views/_common.scss index 38a0e67b4..cb0763c8f 100644 --- a/src/theme/ItaliaTheme/Views/_common.scss +++ b/src/theme/ItaliaTheme/Views/_common.scss @@ -367,3 +367,30 @@ dl.trasparenza-fields { @include rem-size(font-size, 16px); @include rem-size(line-height, 24px); } + +// CT gallery slider +.it-carousel-wrapper { + .slider-container { + .slick-list .slick-track { + .slick-slide { + position: relative; + margin: 0 auto; + + a { + height: 150px; + &.img-wrapper { + position: relative; + overflow: hidden; + width: 100%; + margin: 0; + + img { + min-height: 150px; + object-fit: cover; + } + } + } + } + } + } +}