-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy path_overflow-carousel.scss
110 lines (93 loc) · 2.79 KB
/
_overflow-carousel.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@use '../../settings/include-media' as *;
@use '../../tools/functions/index' as functions;
@mixin overflowCarousel() {
/**
* Components > Overflow Carousel
* --------------------------------
* Allows a list of content to be scrolled horizontally
*
* Example: Used for mobile filter carousel on the Search Page
*
* The `c-overflowCarousel` component is an optional mixin within Fozzie.
* If you'd like to use it in your project you can include it by adding `@include overflowCarousel();` into your SCSS dependencies file.
*
* Documentation:
* TBC
*/
.c-overflowCarousel {
@include media('<mid') {
margin: 0 -#{functions.spacing(d)};
}
}
.c-overflowCarousel-inner {
@include media('<mid') {
@include overflowCarouselInner();
&.is-active {
overflow: visible;
}
}
.c-overflowCarousel--fromMid & {
@include media('<=mid') {
@include overflowCarouselInner();
&.is-active {
overflow: visible;
}
}
}
}
.c-overflowCarousel-content {
@include media('<mid') {
@include overflowCarouselContent();
}
.c-overflowCarousel--fromMid & {
@include media('<=mid') {
@include overflowCarouselContent();
}
}
}
//solution for block children elements
.c-overflowCarousel--withBlockElements {
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
padding: functions.spacing() functions.spacing(d);
-webkit-overflow-scrolling: touch;
-ms-overflow-style: none;
//add spacing after the last element
&:after {
content: '';
flex: 0 0 functions.spacing(d);
}
@include media('>mid') {
padding: functions.spacing(d) functions.spacing(f) functions.spacing();
}
.c-overflowCarousel-item {
flex: 1 0 auto;
margin-right: functions.spacing();
@include media('>=mid') {
margin-right: functions.spacing(d);
}
}
}
.c-overflowCarousel--hideScroll {
@include media('>=wide') {
scrollbar-width: none; // stylelint-disable-line property-no-unknown
}
}
.c-overflowCarousel--hideScroll::-webkit-scrollbar {
width: 0;
display: none;
}
}
@mixin overflowCarouselInner() {
overflow-x: scroll;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
width: 100%;
}
@mixin overflowCarouselContent() {
display: inline-flex;
white-space: nowrap;
padding-left: functions.spacing(d);
padding-right: functions.spacing(d);
}