-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy path_layout.scss
More file actions
78 lines (69 loc) · 2.01 KB
/
Copy path_layout.scss
File metadata and controls
78 lines (69 loc) · 2.01 KB
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
// Foundation for Sites
// https://get.foundation
// Licensed under MIT Open Source
////
/// @group grid
////
@use "sass:meta";
/// Sizes child elements so that `$n` number of items appear on each row.
///
/// @param {Number} $n - Number of elements to display per row.
/// @param {String} $selector ['.column'] - Selector(s) to use for child elements.
/// @param {Number|List} $gutter
/// The gutter to apply to child elements. Accepts multiple values:
/// - $grid-column-gutter will use the values in the $grid-column-gutter map, including breakpoint sizes.
/// - A fixed numeric value will apply this gutter to all breakpoints.
@mixin grid-layout(
$n,
$selector: '.column',
$gutter: null
) {
& > #{$selector} {
float: $global-left;
width: percentage(divide(1, $n));
// If a $gutter value is passed
@if($gutter) {
// Gutters
@if meta.type-of($gutter) == 'map' {
@each $breakpoint, $value in $gutter {
$padding: rem-calc($value) * 0.5;
@include breakpoint($breakpoint) {
padding-right: $padding;
padding-left: $padding;
}
}
}
@else if meta.type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
$padding: rem-calc($gutter) * 0.5;
padding-right: $padding;
padding-left: $padding;
}
}
&:nth-of-type(1n) {
clear: none;
}
&:nth-of-type(#{$n}n+1) {
clear: both;
}
&:last-child {
float: $global-left;
}
}
}
/// Adds extra CSS to block grid children so the last items in the row center automatically. Apply this to the columns, not the row.
///
/// @param {Number} $n - Number of items that appear in each row.
@mixin grid-layout-center-last($n) {
@for $i from 1 to $n {
@if $i == 1 {
&:nth-child(#{$n}n+1):last-child {
margin-left: (100 - divide(100, $n) * $i) * 0.5 * 1%;
}
}
@else {
&:nth-child(#{$n}n+1):nth-last-child(#{$i}) {
margin-left: (100 - divide(100, $n) * $i) * 0.5 * 1%;
}
}
}
}