Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: slider styles + arrows in ct gallery #764

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
63 changes: 35 additions & 28 deletions src/components/ItaliaTheme/View/Commons/Gallery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand All @@ -58,6 +60,8 @@ const Gallery = ({
speed: 500,
slidesToShow: nItems < 3 ? nItems : 3,
slidesToScroll: slideToScroll ?? 3,
nextArrow: <SliderNextArrow intl={intl} />,
prevArrow: <SliderPrevArrow intl={intl} />,
responsive: [
{
breakpoint: 1024,
Expand Down Expand Up @@ -154,37 +158,40 @@ const Gallery = ({
<Slider {...getSettings(images.length)}>
{images.map((item, i) => (
<SingleSlideWrapper key={item['@id']} index={i}>
<figure>
<UniversalLink
item={item}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
setViewImageIndex(i);
}}
onKeyDown={(e) => {
if (e.keyCode === 13) {
<div className={'slide-wrapper'} role="presentation">
<figure className="img-wrapper">
<UniversalLink
item={item}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
setViewImageIndex(i);
}
}}
aria-label={`${intl.formatMessage(
messages.viewPreview,
)} ${item.title}`}
>
<Image
item={item}
alt={item.title}
className="img-fluid"
loading="lazy"
sizes={`(max-width:320px) 300px, (max-width:425px) 400px, ${default_width_image}`}
/>
</UniversalLink>
<figcaption className="figure-caption mt-2">
{item.title}
</figcaption>
</figure>
}}
onKeyDown={(e) => {
if (e.keyCode === 13) {
e.preventDefault();
e.stopPropagation();
setViewImageIndex(i);
}
}}
aria-label={`${intl.formatMessage(
messages.viewPreview,
)} ${item.title}`}
className="img-wrapper"
>
<Image
item={item}
alt={item.title}
className="img-fluid"
loading="lazy"
sizes={`(max-width:320px) 300px, (max-width:425px) 400px, ${default_width_image}`}
/>
</UniversalLink>
<figcaption className="figure-caption mt-2">
{item.title}
</figcaption>
</figure>
</div>
</SingleSlideWrapper>
))}
</Slider>
Expand Down
27 changes: 27 additions & 0 deletions src/theme/ItaliaTheme/Views/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
}
}
}
Loading