feat(carousel): add main carousel component with image support and integrate into store home page
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.main-carousel {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
background: #dedede;
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--color-primary, #6376f3);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
&__viewport {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 1;
|
||||
min-height: 9rem;
|
||||
max-height: 25rem;
|
||||
}
|
||||
|
||||
&__image {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition:
|
||||
opacity 500ms ease,
|
||||
visibility 500ms ease;
|
||||
user-select: none;
|
||||
|
||||
&--active {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
&__indicators {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: clamp(0.45rem, 1.2vw, 0.8rem);
|
||||
left: 50%;
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
&__indicator {
|
||||
width: 0.32rem;
|
||||
height: 0.32rem;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
background: rgba(255, 255, 255, 0.55);
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
|
||||
transition:
|
||||
background-color 150ms ease,
|
||||
transform 150ms ease;
|
||||
|
||||
&:hover,
|
||||
&--active {
|
||||
background: #ffffff;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid #ffffff;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.main-carousel__viewport {
|
||||
aspect-ratio: 2 / 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.main-carousel__image {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user