This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_layout.scss
115 lines (102 loc) · 2.54 KB
/
_layout.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
////
/// Framework - Layouts
////
@mixin container($width: 'default') {
margin-left: auto;
margin-right: auto;
width: 100%;
padding-left: 24px;
padding-right: 24px;
max-width: $global-width;
@if $width == 'default' {
@include breakpoint(large) {
padding-left: 45px;
padding-right: 45px;
}
} @else if $width == 'narrow' {
@include breakpoint(large) {
padding-left: 100px;
padding-right: 100px;
}
@include breakpoint(xlarge) {
padding-left: 165px;
padding-right: 165px;
}
}
}
////
/// @group grid
////
/// 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
) {
display: flex;
flex-wrap: wrap;
& > #{$selector} {
width: percentage(1 / $n);
// If a $gutter value is passed
@if ($gutter) {
// Gutters
@if type-of($gutter) == 'map' {
@each $breakpoint, $value in $gutter {
$padding: rem-calc($value) / 2;
@include breakpoint($breakpoint) {
padding: $padding;
}
}
} @else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
$padding: rem-calc($gutter) / 2;
padding: $padding;
}
}
&:nth-of-type(1n) {
clear: none;
}
&:nth-of-type(#{$n}n+1) {
clear: both;
}
&:last-child {
float: $global-left;
}
}
@if ($gutter) {
// Gutters
@if type-of($gutter) == 'map' {
@each $breakpoint, $value in $gutter {
$padding: rem-calc($value) / 2;
@include breakpoint($breakpoint) {
margin-left: -$padding;
margin-right: -$padding;
}
}
} @else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
$padding: rem-calc($gutter) / 2;
margin-left: -$padding;
margin-right: -$padding;
}
}
}
@mixin image-crop-height($height) {
position: relative;
width: 100%;
height: rem-calc($height);
overflow: hidden;
img {
position: absolute;
left: 50%;
top: 50%;
height: auto;
width: 100%;
transform: translate(-50%, -50%);
}
}