feat(carousel): implement product carousel component with mock data and styles
This commit is contained in:
75
src/app/shared/components/carousel/carousel.component.scss
Normal file
75
src/app/shared/components/carousel/carousel.component.scss
Normal file
@@ -0,0 +1,75 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.carousel {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&__viewport {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
overscroll-behavior-inline: contain;
|
||||
scroll-behavior: smooth;
|
||||
scroll-snap-type: inline mandatory;
|
||||
scrollbar-width: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--color-primary, currentColor);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&__item {
|
||||
flex: 0 0 auto;
|
||||
min-width: 0;
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
|
||||
&__control {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
display: grid;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
padding: 0;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
background: rgb(0 0 0 / 55%);
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
place-items: center;
|
||||
transform: translateY(-50%);
|
||||
|
||||
&:disabled {
|
||||
cursor: default;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--color-primary, currentColor);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
&--previous {
|
||||
left: 0.5rem;
|
||||
}
|
||||
|
||||
&--next {
|
||||
right: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.carousel__viewport {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user