UNPKG

7.01 kBSCSSView Raw
1@use 'sass:math';
2@use '../internal' as *;
3
4/* HEADER */
5
6/* This works well with panel */
7section {
8 display: block;
9}
10
11.content {
12 max-width: 48em;
13 margin: 0 auto 1.5em;
14 width: 100%;
15
16 @include screen-above($md) {
17 max-width: 64em;
18 }
19
20 @include screen-above($lg) {
21 max-width: 80em;
22 }
23
24 @include screen-above($xl) {
25 max-width: 96em;
26 }
27}
28
29.fullscreen {
30 top: 0;
31 right: 0;
32 bottom: 0;
33 left: 0;
34 min-height: 100vh;
35}
36
37/* This works well with spans and maybe even hr */
38.divider {
39 border-top: 0.05rem solid transparentize(fill('gray', '500'), 0.5);
40 height: 0.1rem;
41 margin: 1.8rem 0 1.6rem;
42 position: relative;
43
44 &[data-content] {
45 margin: 0.8rem 0;
46 }
47
48 &--v[data-content]::after,
49 &[data-content]::after {
50 background: #fff;
51 color: fill('gray', '500');
52 content: attr(data-content);
53 left: 50%;
54 display: inline-block;
55 padding: 0 0.4rem;
56 position: absolute;
57 transform: translate(-50%, -50%);
58 top: 50%;
59 }
60
61 &--v,
62 &--v[data-content] {
63 display: block;
64 padding: 0.8rem;
65
66 &::before {
67 border-left: 0.05rem solid transparentize(fill('gray', '500'), 0.5);
68 bottom: 0.4rem;
69 content: '';
70 display: block;
71 left: 50%;
72 position: absolute;
73 top: 0;
74 transform: translateX(-50%);
75 }
76 }
77
78 &--v[data-content] {
79 left: 50%;
80 padding: 0.2rem 0;
81 position: absolute;
82 top: 50%;
83 transform: translate(-50%, -50%);
84 }
85}
86/* Hero image div */
87.hero-img {
88 /* Specify the backgroud image yourself */
89 background-size: cover;
90}
91
92.parallax-img {
93 background-attachment: fixed !important;
94}
95
96.hero {
97 /* Parent of hero-body */
98 align-items: stretch;
99 display: flex; /* Important to stretch height of hero-body */
100 justify-content: space-between;
101
102 .hero-body {
103 flex-grow: 1; /* Tells the hero-body to take up the entire space */
104 flex-shrink: 0;
105 padding: 3rem 1.5rem;
106 align-items: center;
107 display: flex;
108 width: 100%;
109 }
110}
111
112.space {
113 display: block;
114 width: 100%;
115 height: 1rem;
116
117 @each $size, $property-map in $space-sizes {
118 &.space--#{$size} {
119 @include explode-properties($property-map);
120 }
121 }
122}
123
124/* Use for spacing out elements vertically */
125.row {
126 flex: 1;
127 flex-wrap: wrap;
128 padding: 0.5rem 0;
129 display: flex;
130
131 &::after {
132 content: '';
133 clear: both;
134 display: table;
135 }
136
137 &.row--no-wrap {
138 flex-wrap: nowrap;
139 overflow-x: auto; /* Can be disabled to remove scroll bar */
140 }
141
142 /* GRID */
143 .col {
144 display: block;
145 flex: 1;
146 padding: 0.15rem 0.75rem;
147 }
148
149 /* Auto align col to left in row */
150 .offset-right {
151 margin-left: 0;
152 margin-right: auto;
153 }
154
155 /* Auto align col to middle in row */
156 .offset-center {
157 margin-left: auto;
158 margin-right: auto;
159 }
160 /* Auto align col to right in row */
161 .offset-left {
162 margin-left: auto;
163 margin-right: 0;
164 }
165
166 /* Dividers for mobile layout */
167 &.divided [class^='col'],
168 &.divided [class*=' col'] {
169 box-shadow: 0 -1px 0 0 transparentize(fill('gray', '500'), 0.5);
170 }
171
172 /* Base sizing where everything is 100% width */
173 [class^='col-'],
174 [class*=' col-'] {
175 width: 100%;
176 margin-left: 0;
177 padding: 0 0.5rem;
178 }
179
180 /* Column sizes for various viewports */
181 @for $i from 1 through $flex-columns {
182 @include screen-above($sm) {
183 // Same as col-md-<number>
184 .col-#{$i} {
185 width: percentage($number: $flex-width * $i);
186 }
187 }
188 }
189
190 @include generate-styles-with-viewports() using ($viewport) {
191 @for $i from 1 through $flex-columns {
192 // For sm, viewport is empty
193 $v: if($viewport != '', '-#{$viewport}-', '-xs-');
194 .col#{$v}#{$i} {
195 width: percentage($number: $flex-width * $i);
196 }
197 }
198 }
199
200 @for $i from 1 through $flex-columns {
201 @include screen-above($xs) {
202 .offset-#{$i} {
203 margin-left: percentage($number: $flex-width * $i);
204 }
205 }
206 }
207
208 /* Columns without the spacing */
209 &.no-space [class^='col-'],
210 &.no-space [class*=' col-'] {
211 padding: 0;
212 }
213}
214
215.r {
216 /* Legacy row pre 0.5.5 */
217 max-width: 100%;
218 padding: 0.5rem;
219}
220
221.level {
222 align-items: center;
223 justify-content: space-between;
224
225 .level-item {
226 /* Centers items */
227 align-items: center;
228 display: flex;
229 flex-basis: auto;
230 flex-grow: 0;
231 flex-shrink: 0;
232 justify-content: center;
233 }
234
235 /* Used to stretch the contents of div in level to fill */
236 .level-content {
237 flex-basis: auto;
238 flex-grow: 1;
239 flex-shrink: 1;
240 text-align: left;
241 width: 100%;
242 }
243}
244
245/* Width/Height CSS */
246@include generate-classes-for-viewport-with-map($heights, 'height', 'h-', #{get-viewport-flag($HEIGHTS)});
247@include generate-classes-for-viewport-with-map($widths, 'width', 'w-', #{get-viewport-flag($WIDTHS)});
248@include generate-classes-for-viewport-with-map(
249 $min-heights,
250 'min-height',
251 'min-h-',
252 #{get-viewport-flag($MIN-HEIGHT)}
253);
254@include generate-classes-for-viewport-with-map($min-widths, 'min-width', 'min-w-', #{get-viewport-flag($MIN-WIDTH)});
255@include generate-classes-for-viewport-with-map(
256 $max-heights,
257 'max-height',
258 'max-h-',
259 #{get-viewport-flag($MAX-HEIGHT)}
260);
261@include generate-classes-for-viewport-with-map($max-widths, 'max-width', 'max-w-', #{get-viewport-flag($MAX-WIDTH)});
262
263/* Do the actual balancing only on larger screens */
264.level,
265.level-left,
266.level-right {
267 @include screen-above($sm) {
268 display: flex;
269 }
270}
271
272@include screen-below($sm) {
273 .level-right {
274 margin-left: 1rem;
275 }
276
277 /* Keep all level children the same height */
278 .level.fill-height {
279 align-items: stretch;
280 display: flex;
281 }
282}
283
284/* MOBILE */
285@include screen-below($sm) {
286 .container {
287 width: 100%;
288 }
289
290 .row {
291 margin-top: 0;
292 }
293
294 /* Dividers for mobile layout */
295 .divided > .row [class^='col-'],
296 .divided > .row [class*=' col-'] {
297 box-shadow: 0 -1px 0 0 rgba(34, 36, 38, 0.15);
298 }
299
300 .level.fill-height {
301 display: inherit; /* Allow children to expand */
302 }
303
304 .hero-body {
305 padding: 0;
306 }
307}