feat(carousel): implement circular layout and enhance navigation logic

This commit is contained in:
2026-07-23 12:09:21 -03:00
parent fb6ab2fca2
commit a1d5ecb6fa
4 changed files with 211 additions and 60 deletions

View File

@@ -13,7 +13,6 @@
}
&__viewport {
display: flex;
width: 100%;
overflow-x: auto;
overscroll-behavior-inline: contain;
@@ -29,6 +28,39 @@
outline: 2px solid var(--color-primary, currentColor);
outline-offset: 2px;
}
&--circular {
overflow: hidden;
scroll-snap-type: none;
}
}
&__linear-track,
&__page {
display: flex;
}
&__track {
display: flex;
width: 300%;
transform: translateX(calc(-100% / 3));
&--moving {
transition: transform 300ms ease;
}
&--previous {
transform: translateX(0);
}
&--next {
transform: translateX(calc(-200% / 3));
}
}
&__page {
flex: 0 0 calc(100% / 3);
min-width: 0;
}
&__item {
@@ -77,4 +109,8 @@
.carousel__viewport {
scroll-behavior: auto;
}
.carousel__track--moving {
transition-duration: 1ms;
}
}