carousel.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. @import './animation.scss';
  2. @import './variables.scss';
  3. $module: #{$prefix}-carousel;
  4. .#{$module} {
  5. position: relative;
  6. overflow: hidden;
  7. &-content {
  8. width: 100%;
  9. height: 100%;
  10. overflow: hidden;
  11. position: relative;
  12. &-item {
  13. position: absolute;
  14. left: 0;
  15. top: 0;
  16. width: 100%;
  17. height: 100%;
  18. overflow: hidden;
  19. &-current {
  20. z-index: 1;
  21. }
  22. }
  23. &-fade {
  24. > * {
  25. opacity: 0;
  26. }
  27. .#{$module}-content-item-current {
  28. opacity: 1;
  29. }
  30. }
  31. &-slide {
  32. & > *:not(.#{$module}-content-item-current) {
  33. visibility: hidden;
  34. }
  35. .#{$module}-content-item-slide-out {
  36. display: block;
  37. animation: #{$module}-content-item-keyframe-slide-out;
  38. }
  39. .#{$module}-content-item-slide-in {
  40. display: block;
  41. animation: #{$module}-content-item-keyframe-slide-in;
  42. }
  43. }
  44. &-reverse {
  45. .#{$module}-content-item-slide-out {
  46. animation: #{$module}-content-item-keyframe-slide-out-reverse;
  47. }
  48. .#{$module}-content-item-slide-in {
  49. animation: #{$module}-content-item-keyframe-slide-in-reverse;
  50. }
  51. }
  52. }
  53. &-indicator {
  54. display: flex;
  55. align-items: flex-end;
  56. z-index: 2;
  57. &-left {
  58. position: absolute;
  59. left: $spacing-carousel_indicator-padding;
  60. bottom: $spacing-carousel_indicator-padding;
  61. }
  62. &-center {
  63. position: absolute;
  64. left: 50%;
  65. bottom: $spacing-carousel_indicator-padding;
  66. transform: translate(-50%);
  67. }
  68. &-right {
  69. position: absolute;
  70. right: $spacing-carousel_indicator-padding;
  71. bottom: $spacing-carousel_indicator-padding;
  72. }
  73. &-dot {
  74. .#{$module}-indicator-item {
  75. border-radius: $radius-carousel_indicator_dot;
  76. cursor: pointer;
  77. &:not(:last-child) {
  78. margin-right: $spacing-carousel_indicator_dot-marginX;
  79. }
  80. &-small {
  81. width: $width-carousel_indicator_dot_small;
  82. height: $width-carousel_indicator_dot_small;
  83. }
  84. &-medium {
  85. width: $width-carousel_indicator_dot_medium;
  86. height: $width-carousel_indicator_dot_medium;
  87. }
  88. &-primary {
  89. background-color: $color-carousel_indicator_theme_primary-bg-default;
  90. transition: background-color $transition_duration-carousel_indicator-bg
  91. $transition_function-carousel_indicator-bg $transition_delay-carousel_indicator-bg;
  92. &.#{$module}-indicator-item-active {
  93. background: $color-carousel_indicator_theme_primary-bg-active;
  94. }
  95. &:hover {
  96. background-color: $color-carousel_indicator_theme_primary-bg-hover;
  97. }
  98. &:active {
  99. background: $color-carousel_indicator_theme_primary-bg-active;
  100. }
  101. }
  102. &-light {
  103. background-color: $color-carousel_indicator_theme_light-bg-default;
  104. transition: background-color $transition_duration-carousel_indicator-bg
  105. $transition_function-carousel_indicator-bg $transition_delay-carousel_indicator-bg;
  106. &.#{$module}-indicator-item-active {
  107. background: $color-carousel_indicator_theme_light-bg-active;
  108. }
  109. &:hover {
  110. background-color: $color-carousel_indicator_theme_light-bg-hover;
  111. }
  112. &:active {
  113. background: $color-carousel_indicator_theme_light-bg-active;
  114. }
  115. }
  116. &-dark {
  117. background-color: $color-carousel_indicator_theme_dark-bg-default;
  118. transition: background-color $transition_duration-carousel_indicator-bg
  119. $transition_function-carousel_indicator-bg $transition_delay-carousel_indicator-bg;
  120. &.#{$module}-indicator-item-active {
  121. background-color: $color-carousel_indicator_theme_dark-bg-active;
  122. }
  123. &:hover {
  124. background-color: $color-carousel_indicator_theme_dark-bg-hover;
  125. }
  126. &:active {
  127. background: $color-carousel_indicator_theme_dark-bg-active;
  128. }
  129. }
  130. }
  131. }
  132. &-line {
  133. width: $width-carousel_indicator_line;
  134. .#{$module}-indicator-item {
  135. flex: 1;
  136. cursor: pointer;
  137. &:not(:last-child) {
  138. margin-right: $spacing-carousel_indicator_line-marginX;
  139. }
  140. &-small {
  141. height: $height-carousel_indicator_line_small;
  142. }
  143. &-medium {
  144. height: $height-carousel_indicator_line_medium;
  145. }
  146. &-primary {
  147. background-color: $color-carousel_indicator_theme_primary-bg-default;
  148. &.#{$module}-indicator-item-active {
  149. background: $color-carousel_indicator_theme_primary-bg-active;
  150. }
  151. &:hover {
  152. background-color: $color-carousel_indicator_theme_primary-bg-hover;
  153. }
  154. &:active {
  155. background: $color-carousel_indicator_theme_primary-bg-active;
  156. }
  157. }
  158. &-light {
  159. background-color: $color-carousel_indicator_theme_light-bg-default;
  160. &.#{$module}-indicator-item-active {
  161. background: $color-carousel_indicator_theme_light-bg-active;
  162. }
  163. &:hover {
  164. background-color: $color-carousel_indicator_theme_light-bg-hover;
  165. }
  166. &:active {
  167. background: $color-carousel_indicator_theme_light-bg-active;
  168. }
  169. }
  170. &-dark {
  171. background-color: $color-carousel_indicator_theme_dark-bg-default;
  172. &.#{$module}-indicator-item-active {
  173. background: $color-carousel_indicator_theme_dark-bg-active;
  174. }
  175. &:hover {
  176. background-color: $color-carousel_indicator_theme_dark-bg-hover;
  177. }
  178. &:active {
  179. background: $color-carousel_indicator_theme_dark-bg-active;
  180. }
  181. }
  182. }
  183. }
  184. &-columnar {
  185. .#{$module}-indicator-item {
  186. cursor: pointer;
  187. &:not(:last-child) {
  188. margin-right: $spacing-carousel_indicator_columnar-marginX;
  189. }
  190. &-small {
  191. width: $width-carousel_indicator_columnar_small;
  192. height: $height-carousel_indicator_columnar_small_default;
  193. &.#{$module}-indicator-item-active {
  194. height: $height-carousel_indicator_columnar_small_active;
  195. }
  196. }
  197. &-medium {
  198. width: $width-carousel_indicator_columnar_medium;
  199. height: $height-carousel_indicator_columnar_medium_default;
  200. &.#{$module}-indicator-item-active {
  201. height: $height-carousel_indicator_columnar_medium_active;
  202. }
  203. }
  204. &-primary {
  205. background-color: $color-carousel_indicator_theme_primary-bg-default;
  206. &.#{$module}-indicator-item-active {
  207. background: $color-carousel_indicator_theme_primary-bg-active;
  208. }
  209. &:hover {
  210. background-color: $color-carousel_indicator_theme_primary-bg-hover;
  211. }
  212. &:active {
  213. background: $color-carousel_indicator_theme_primary-bg-active;
  214. }
  215. }
  216. &-light {
  217. background-color: $color-carousel_indicator_theme_light-bg-default;
  218. &.#{$module}-indicator-item-active {
  219. background: $color-carousel_indicator_theme_light-bg-active;
  220. }
  221. &:hover {
  222. background-color: $color-carousel_indicator_theme_light-bg-hover;
  223. }
  224. &:active {
  225. background: $color-carousel_indicator_theme_light-bg-active;
  226. }
  227. }
  228. &-dark {
  229. background-color: $color-carousel_indicator_theme_dark-bg-default;
  230. &.#{$module}-indicator-item-active {
  231. background: $color-carousel_indicator_theme_dark-bg-active;
  232. }
  233. &:hover {
  234. background-color: $color-carousel_indicator_theme_dark-bg-hover;
  235. }
  236. &:active {
  237. background: $color-carousel_indicator_theme_dark-bg-active;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. &-arrow {
  244. display: flex;
  245. font-size: $width-carousel_arrow;
  246. cursor: pointer;
  247. &-prev {
  248. position: absolute;
  249. top: 50%;
  250. left: $spacing-carousel_arrow-left;
  251. transform: translateY(-50%);
  252. z-index: 2;
  253. }
  254. &-next {
  255. position: absolute;
  256. top: 50%;
  257. right: $spacing-carousel_arrow-right;
  258. transform: translateY(-50%);
  259. z-index: 2;
  260. }
  261. &-light {
  262. color: $color-carousel_arrow_theme_light-bg-default;
  263. transition: color $transition_duration-carousel_arrow-bg $transition_funciton_carousel_arrow-bg
  264. $transition_delay-carousel_arrow-bg;
  265. &:hover {
  266. color: $color-carousel_arrow_theme_light-bg-hover;
  267. }
  268. }
  269. &-primary {
  270. color: $color-carousel_arrow_theme_primary-bg-default;
  271. transition: color $transition_duration-carousel_arrow-bg $transition_funciton_carousel_arrow-bg
  272. $transition_delay-carousel_arrow-bg;
  273. &:hover {
  274. color: $color-carousel_arrow_theme_primary-bg-hover;
  275. }
  276. }
  277. &-dark {
  278. color: $color-carousel_arrow_theme_dark-bg-default;
  279. transition: color $transition_duration-carousel_arrow-bg $transition_funciton_carousel_arrow-bg
  280. $transition_delay-carousel_arrow-bg;
  281. &:hover {
  282. color: $color-carousel_arrow_theme_dark-bg-hover;
  283. }
  284. }
  285. }
  286. &-arrow-hover div {
  287. z-index: 2;
  288. opacity: 0;
  289. }
  290. &:hover {
  291. .#{$module}-arrow-hover div {
  292. opacity: 1;
  293. }
  294. }
  295. }
  296. @keyframes #{$module}-content-item-keyframe-slide-in {
  297. from {
  298. transform: translateX(100%);
  299. }
  300. to {
  301. transform: translateX(0);
  302. }
  303. }
  304. @keyframes #{$module}-content-item-keyframe-slide-out {
  305. from {
  306. transform: translateX(0);
  307. }
  308. to {
  309. transform: translateX(-100%);
  310. }
  311. }
  312. @keyframes #{$module}-content-item-keyframe-slide-in-reverse {
  313. from {
  314. transform: translateX(-100%);
  315. }
  316. to {
  317. transform: translateX(0);
  318. }
  319. }
  320. @keyframes #{$module}-content-item-keyframe-slide-out-reverse {
  321. from {
  322. transform: translateX(0);
  323. }
  324. to {
  325. transform: translateX(100%);
  326. }
  327. }
  328. @import './rtl.scss';