-
Notifications
You must be signed in to change notification settings - Fork 615
/
Copy path_heroCarousel.scss
163 lines (135 loc) · 3.92 KB
/
_heroCarousel.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// HERO CAROUSEL
// -----------------------------------------------------------------------------
//
// Purpose: Styles the hero carousel component, which basically adds extras to the
// vendor slick carousel, to specifically display hero images.
//
// 1. Use object-fit on the image tag to keep aspect ratio and cover the space
// created by the outer div. The JS will detect browsers that do not support
// object-fit and instead copy the image src to a the background-image of the
// wrapper div and add the compat-object-fit class.
//
// 2. Visually overrides the top margin for '.body' defined in _body.scss.
// The '.body' top margin creates space between the header and page content.
// However, on the homepage, we want the carousel to be flush with the header.
//
// 3. Allows image to scale on large screens while preventing the top and bottom
// from becoming cut off.
// -----------------------------------------------------------------------------
.heroCarousel {
width: 1px;
min-width: 100%;
margin-bottom: (spacing("double") + spacing("single"));
margin-top: -(spacing("single")); // 3
@include breakpoint("medium") {
margin-top: -(spacing("single") + spacing("base")); // 3
}
&.slick-initialized { // 2
max-height: remCalc(1000);
opacity: 1;
}
&:not(.slick-initialized) :not(.heroCarousel-slide--first).heroCarousel-slide {
display: none;
}
.slick-next,
.slick-prev {
top: 50%;
}
.slick-next {
right: 15px;
@include breakpoint("medium") {
right: 25px;
}
}
.slick-prev {
left: 15px;
@include breakpoint("medium") {
left: 25px;
}
}
.slick-dots {
bottom: spacing("third");
@include breakpoint("medium") {
bottom: spacing("single");
}
// scss-lint:disable SelectorDepth, NestingDepth
li {
@include carouselOpaqueBackgrounds($slick-dot-bgColor);
}
}
}
.heroCarousel-slide {
position: relative;
a {
text-decoration: none;
}
.heroCarousel-image {
@include breakpoint("medium") {
object-fit: cover; // 1
max-height: remCalc(600px);
width: 100%;
}
}
.heroCarousel-image-wrapper {
@include breakpoint("medium") {
max-height: remCalc(600px);
}
}
&.compat-object-fit { // 1
background-size: cover;
background-position: 50%;
background-repeat: no-repeat;
&.stretch {
@include breakpoint("large") { // 4
background-size: 100% 100%;
}
}
.heroCarousel-image {
opacity: 0;
}
}
}
.heroCarousel-content {
background-color: rgba($carousel-bgColor, 1);
padding: spacing("half") spacing("single") (spacing("double"));
text-align: center;
@include breakpoint("medium") {
@include carouselOpaqueBackgrounds;
background-color: rgba($carousel-bgColor, 0.9);
left: 0;
margin: 0 auto;
padding: spacing("single") * 1.5;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: remCalc(700px);
&.heroCarousel-content--empty {
background-color: transparent;
}
}
}
.heroCarousel-title {
color: $carousel-title-color;
font-size: fontSize("small");
margin-top: 0;
@include breakpoint("medium") {
font-size: fontSize("hero");
}
}
.heroCarousel-description {
color: $carousel-description-color;
font-size: fontSize("tiny");
@include breakpoint("small") {
font-size: fontSize("smallest");
}
@include breakpoint("medium") {
font-size: fontSize("smaller");
}
}
.heroCarousel-action {
margin: 0;
@include breakpoint("medium") {
margin-top: spacing("single");
}
}