Skip to content

Commit

Permalink
DEX-21697 - Elements not fully visible in the box-carousel component
Browse files Browse the repository at this point in the history
  • Loading branch information
ltiseanu committed Feb 3, 2025
1 parent cdc5235 commit 321ac23
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
7 changes: 2 additions & 5 deletions _src/blocks/box-carousel/box-carousel.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
width: 100%;
position: relative;
display: flex;
overflow: hidden;
}

.box-carousel-container .carousel {
display: flex;
align-items: stretch;
transition: transform 150ms cubic-bezier(0.165, 0.84, 0.44, 1) 0s;
}

Expand All @@ -51,7 +51,7 @@
display: flex;
flex-direction: column;
width: 220px;
min-height: 220px;
height: 100%;
margin: 10px;
box-sizing: border-box;
padding: 20px;
Expand All @@ -65,7 +65,6 @@

.box-carousel-container.testimonials .carousel-item {
width: 300px;
height: 300px;
display: flex;
flex-direction: column;
border: solid 1px #ddd;
Expand Down Expand Up @@ -172,7 +171,6 @@

.box-carousel-container.testimonials .carousel-item {
width: calc((100% - 25px) / 2);
min-height: 390px;
}

.box-carousel-container .carousel-item .subtitle {
Expand All @@ -191,7 +189,6 @@

.box-carousel-container.testimonials .carousel-item {
width: calc((100% - 25px) / 3);
min-height: 390px;
}

.box-carousel-container .carousel-item .title {
Expand Down
10 changes: 10 additions & 0 deletions _src/blocks/box-carousel/box-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ export default async function decorate(block) {
const [titleEl, ...slides] = [...block.children];
let currentSlideIndex = 0;

const countItems = slides.length;
let countClass = `has-${countItems}-items`;
if (countItems > 3 && countItems < 7) {
countClass = 'has-3-7-items';
}
if (countItems > 7) {
countClass = 'has-more-items';
}
block.classList.add(countClass);

const isTestimonials = block.closest('.section').classList.contains('testimonials');

const carouselItemStyle = {
Expand Down
14 changes: 11 additions & 3 deletions _src/scripts/template-factories/trusted.css
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,12 @@ main .section.link-right a {
}

.trusted .box-carousel-container.testimonials .carousel-item {
width: calc(100% / 4.3);
padding: 2em;
}

.trusted .box-carousel-container.testimonials .has-3-7-items .carousel-item {
width: calc(100% / 3 - 70px);
min-height: 470px;
padding: 50px 35px 45px;
}

.trusted .box-carousel-container.testimonials .carousel-item .subtitle-secondary {
Expand Down Expand Up @@ -874,6 +877,10 @@ main .section.link-right a {
padding: 14px 0;
margin-bottom: 0;
}

.trusted .box-carousel-container .default-content-wrapper {
padding: 0 1em;
}
}

@media (max-width: 992px) {
Expand Down Expand Up @@ -914,6 +921,7 @@ main .section.link-right a {

.trusted .box-carousel-container.testimonials .carousel-item {
width: 300px;
padding: 1em 50px;
padding: 1em;
margin: 0 1em;
}
}

0 comments on commit 321ac23

Please sign in to comment.