-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_mixins.scss
172 lines (143 loc) · 3.53 KB
/
_mixins.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
164
165
166
167
168
169
170
171
172
%clearfix {
&::after {
display: table;
clear: both;
content: '';
}
}
@mixin rprop($prop, $phone: '', $tablet: '', $desktop: null) {
#{$prop}: $phone;
@include breakpoint(medium) {#{$prop}: $tablet;}
@if $desktop != null {
@include breakpoint(large) {#{$prop}: $desktop;}
}
}
@mixin rprop-x($prop, $small-value: null, $medium-value: null, $large-value: null, $xlarge-value: null, $xxlarge-value: null) {
@if $small-value != null {
#{$prop}: $small-value;
}
@if $medium-value != null {
@include breakpoint(medium) {
#{$prop}: $medium-value;
}
}
@if $large-value != null {
@include breakpoint(large) {
#{$prop}: $large-value;
}
}
@if $xlarge-value != null {
@media #{$xlarge-up} {
#{$prop}: $xlarge-value;
}
}
@if $xxlarge-value != null {
@media #{$xxlarge-up} {
#{$prop}: $xxlarge-value;
}
}
}
@mixin small-prop($prop, $value: '') {
@media #{$small-only} {#{$prop}: $value;}
}
@mixin medium-prop($prop, $value: '') {
@media #{$medium-only} {#{$prop}: $value;}
}
@mixin large-prop($prop, $value: '') {
@media #{$large-only} {#{$prop}: $value;}
}
@mixin xlarge-prop($prop, $value: '') {
@media #{$xlarge-only} {#{$prop}: $value;}
}
@mixin xxlarge-prop($prop, $value: '') {
@media #{$xxlarge-only} {#{$prop}: $value;}
}
// Make a responsive column element, with width and padding values for each breakpoint
@mixin grid-columns(
// {Integer} Small columns (i.e 6 = half (6/12))
$small: $grid-column-count,
// {Integer} Medium columns
$medium: false,
// {Integer} Large columns
$large: false,
// {Boolean} Clear left if this column is the "first in the row"
// i.e, if we have n columns per row, every nth column with have
// clear:left to stop elements of different heights breaking the row
$clear: false,
// {Boolean} include left padding
$left-padding: true,
// {Boolean} include right padding
$right-padding: true
){
width: percentage($small / $grid-column-count);
float: left;
@if($clear) {
$n: floor(12 / $small);
$only: '';
@if($medium) {
$only: 'only';
}
@if($n > 1) {
@include breakpoint(small #{$only}) {
&:nth-child(#{$n}n-#{$n - 1}) {
clear: left;
}
}
}
}
$padding: rem-calc(map-get($grid-column-gutter, 'small')) / 2;
@if($right-padding) {
padding-right: $padding;
}
@if($left-padding) {
padding-left: $padding;
}
@include breakpoint(medium) {
@if($medium) {
width: percentage($medium / $grid-column-count);
}
$medium-padding: rem-calc(map-get($grid-column-gutter, 'medium')) / 2;
@if($right-padding) {
padding-right: $medium-padding;
}
@if($left-padding) {
padding-left: $medium-padding;
}
}
@if($clear and $medium) {
$n: floor(12 / $medium);
$only: '';
@if($medium) {
$only: 'only';
}
@if($n > 1) {
@include breakpoint(medium #{$only}) {
&:nth-child(#{$n}n-#{$n - 1}) {
clear: left;
}
}
}
}
@include breakpoint(large) {
@if($large) {
width: percentage($large / $grid-column-count);
}
$large-padding: rem-calc(map-get($grid-column-gutter, 'large')) / 2;
@if($right-padding) {
padding-right: $large-padding;
}
@if($left-padding) {
padding-left: $large-padding;
}
}
@if($clear and $large) {
$n: floor(12 / $large);
@if($n > 1) {
@include breakpoint(large) {
&:nth-child(#{$n}n-#{$n - 1}) {
clear: left;
}
}
}
}
}