-
Notifications
You must be signed in to change notification settings - Fork 0
/
_breakpoints.scss
33 lines (31 loc) · 995 Bytes
/
_breakpoints.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
//breakpoint functions - used wherever we need to generate sass responsive classes
//mobile first
@function get-min($pt, $pts: $grid-breakpoints) {
$min: map-get($pts, $pt);
@return if($min !=0, $min, null);
}
@function get-infix($name, $pts: $grid-breakpoints) {
@return if(get-min($name, $pts) == null, "", "-"+$name);
}
@function get-next($name, $pts: $grid-breakpoints, $pts-names: map-keys($grid-breakpoints)) {
$n: index($pts-names, $name);
@return if($n < length($pts-names), nth($pts-names, $n+1), null);
}
@function get-max($name, $pts: $grid-breakpoints) {
$max: get-next($name, $pts);
@return if($max, get-min($max, $pts), null);
}
@mixin breakpoint-up($name, $pts: $grid-breakpoints) {
$min: get-min($name, $pts);
@if $min {
@media (min-width: $min) {@content};
}
@else { @content }
};
@mixin breakpoint-down($name, $pts: $grid-breakpoints) {
$max: get-max($name, $pts);
@if $max {
@media (min-width: $max) {@content};
}
@else { @content }
};