amis2/scss/components/_carousel.scss

144 lines
3.0 KiB
SCSS
Raw Normal View History

2019-05-16 11:04:55 +08:00
@mixin arrow-control {
2019-05-16 16:31:20 +08:00
width: 10%;
min-width: $Carousel-arrowControl-width;
height: 100%;
2019-05-16 11:04:55 +08:00
cursor: pointer;
position: absolute;
2019-05-16 16:31:20 +08:00
transition-duration: $Carousel-transitionDuration;
}
@mixin svg-props {
position: absolute;
top: 50%;
left: 50%;
right: 50%;
transform: translate(-50%, -50%);
width: $Carousel-svg-width;
height: $Carousel-svg-height;
2019-05-16 11:04:55 +08:00
}
@mixin svg-theme {
&.light {
svg {
2019-05-16 16:31:20 +08:00
@include svg-props;
fill: $Carousel-lightTheme;
2019-05-16 11:04:55 +08:00
}
}
&.dark {
svg {
2019-05-16 16:31:20 +08:00
@include svg-props;
fill: $Carousel-darkTheme;
2019-05-16 11:04:55 +08:00
}
}
}
.#{$ns}Carousel {
position: relative;
display: block;
2019-05-16 16:31:20 +08:00
background: $Carousel-bg;
2019-05-16 11:04:55 +08:00
&-container {
2019-05-16 16:31:20 +08:00
min-width: $Carousel-minWidth;
height: $Carousel-height;
2019-05-16 11:04:55 +08:00
position: relative;
overflow: hidden;
.#{$ns}Carousel-item {
width: 100%;
height: 100%;
position: absolute;
2019-05-16 16:31:20 +08:00
transition: ease-out all $Carousel-transitionDuration;
2019-05-16 11:04:55 +08:00
&.fade {
opacity: 0;
}
&.fade.in {
opacity: 1;
}
2019-05-16 16:31:20 +08:00
&.slide {
2019-05-16 11:04:55 +08:00
transform: translateX(100%);
}
2019-05-16 16:31:20 +08:00
&.slide.in {
2019-05-16 11:04:55 +08:00
transform: translateX(0);
}
2019-05-16 16:31:20 +08:00
&.slide.out {
2019-05-16 11:04:55 +08:00
transform: translateX(-100%);
}
&.slideRight {
transform: translateX(-100%);
}
&.slideRight.in {
transform: translateX(0);
}
&.slideRight.out {
transform: translateX(100%);
}
> span > img {
width: 100%;
height: 100%;
}
}
}
2019-05-16 16:31:20 +08:00
&-dotsControl {
2019-05-16 11:04:55 +08:00
position: absolute;
2019-05-16 16:31:20 +08:00
bottom: 0px;
2019-05-16 11:04:55 +08:00
width: 100%;
z-index: 100;
text-align: center;
.#{$ns}Carousel-dot {
display: inline-block;
2019-05-16 16:31:20 +08:00
height: $Carousel-dot-width;
width: $Carousel-dot-height;
border-radius: $Carousel-dot-borderRadius;
margin: $Carousel-dot-margin;
transition-duration: $Carousel-transitionDuration;
2019-05-16 11:04:55 +08:00
&.light {
2019-05-16 16:31:20 +08:00
background-color: $Carousel-lightTheme;
2019-05-16 11:04:55 +08:00
}
&.dark {
2019-05-16 16:31:20 +08:00
background-color: $Carousel-darkTheme;
2019-05-16 11:04:55 +08:00
}
&.is-default {
opacity: 0.3;
}
&.is-active {
opacity: 1;
}
}
}
2019-05-16 16:31:20 +08:00
&-arrowsControl {
2019-05-16 11:04:55 +08:00
position: absolute;
width: 100%;
height: inherit;
z-index: 100;
text-align: center;
.#{$ns}Carousel-leftArrow {
@include arrow-control;
@include svg-theme;
2019-05-16 16:31:20 +08:00
left: 0;
2019-05-16 11:04:55 +08:00
}
.#{$ns}Carousel-rightArrow {
@include arrow-control;
@include svg-theme;
2019-05-16 16:31:20 +08:00
right: 0;
2019-05-16 11:04:55 +08:00
}
}
}