Last active
March 23, 2017 15:40
-
-
Save ahaywood/6694fc6851d9d677050ba8b7601daa17 to your computer and use it in GitHub Desktop.
Setting up breakpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$breakpoints: ( | |
small: 767px, | |
medium: 992px, | |
large: 1200px | |
); | |
// _mixins.scss | |
@mixin breakpoint($breakpoint) { | |
@if map-has-key($breakpoints, $breakpoint) { | |
@media (min-width: #{map-get($breakpoints, $breakpoint)}) { | |
@content; | |
} | |
} | |
@else { | |
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. " | |
+ "Please make sure it is defined in `$breakpoints` map."; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scss | |
.m-tabs { | |
background-color: #f2f2f2; | |
@include breakpoint(medium) { | |
background-color: #666; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment