carousel.scss 11 KB

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