-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path_m-breakpoint.scss
47 lines (40 loc) · 1.43 KB
/
_m-breakpoint.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
@use "sass:meta";
@use "../01-abstract/variables";
@use "f-em";
@use "sass:map";
/**
* Breakpoints
*
* @author Milan Ricoul
*
* @param $breakpoint
* @param $min-or-max-or-breakpoint
*
* Examples :
*
* @include breakpoints(sm, md) { ... }
* return @media screen and (min-width: 768px) and (max-width: 1024px) { ... }
*
* @include breakpoints(sm, max) { ... }
* return @media screen and (max-width: 767px) { ... }
*
* @include breakpoints(sm) or @include breakpoints(sm, min) { ... }
* return @media screen and (min-width: 768px) { ... }
*
*/
@mixin breakpoints($breakpoint, $min-or-max-or-breakpoint: min) {
$font-size: 16px; // don't use em function whitout param, $font-size-base can be modified
@if (meta.type-of(map.get(variables.$breakpoints, $min-or-max-or-breakpoint)) == "number") {
@media screen and (min-width: f-em.em(map.get(variables.$breakpoints, $breakpoint), $font-size)) and (max-width: f-em.em(map.get(variables.$breakpoints, $min-or-max-or-breakpoint) - 1, $font-size)) {
@content;
}
} @else if ($min-or-max-or-breakpoint == max) {
@media screen and (max-width: f-em.em(map.get(variables.$breakpoints, $breakpoint) - 1, $font-size)) {
@content;
}
} @else {
@media screen and (min-width: f-em.em(map.get(variables.$breakpoints, $breakpoint), $font-size)) {
@content;
}
}
}