-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_responsive.scss
79 lines (67 loc) · 1.64 KB
/
_responsive.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
/* ==========================================================================
Helpers used in responsive webdesign
========================================================================== */
/* Variables
========================================================================== */
/**
* List of available breakpoints
*/
$bits-responsive-breakpoints: (
(v2 "(min-width: 25em)")
(v3 "(min-width: 50em)")
) !default;
/**
* 1. If it is an old IE, don't serve any media query.
* 2. If it is an old IE, what breakpoints to include.
*/
$bits-old-ie: false !default; /* 1 */
$bits-old-ie-breakpoints: () !default; /* 2 */
/* Mixins
========================================================================== */
/**
* Insert media query
*
* Example:
*
* $bits-responsive-breakpoints: (
* (v2 "min-width: 25em")
* (v3 "min-width: 50em")
* );
*
* @include breakpoint(v2) {
* .example {
* text-align: center;
* }
* }
*
* @include breakpoint(v3) {
* .example {
* text-align: right;
* }
* }
*/
@mixin breakpoint($name) {
$breakpoint-found: false;
@each $breakpoint in $bits-responsive-breakpoints {
$breakpoint-name: nth($breakpoint, 1);
$media-query: nth($breakpoint, 2);
@if $name == $breakpoint-name {
$breakpoint-found: true;
@if $bits-old-ie == true {
@each $ie-bp in $bits-old-ie-breakpoints {
@if $name == $ie-bp {
@content;
}
}
}
@else {
@media only screen and #{$media-query} {
@content;
}
}
}
}
@if $breakpoint-found == false {
@warn "Breakpoint '#{$name}' does not exist.";
}
}