KNACSS/sass/_config/_mixins.scss
2016-12-01 15:45:23 +01:00

44 lines
1.1 KiB
SCSS

// Additionnal "utility" breakpoints aliases
// ex. @include respond-to("medium-up") {...}
@function breakpoint($bp) {
@if $bp == 'tiny' {
@return '(max-width: #{$tiny})';
}
@else if $bp == 'small' {
@return '(max-width: #{$small})';
}
@else if $bp == 'medium' {
@return '(max-width: #{$medium})';
}
@else if $bp == 'large' {
@return '(max-width: #{$large})';
}
@else if $bp == 'extra-large' {
@return '(max-width: #{$extra-large})';
}
@else if $bp == 'tiny-up' {
@return '(min-width: #{$tiny + 1})';
}
@else if $bp == 'small-up' {
@return '(min-width: #{$small + 1})';
}
@else if $bp == 'medium-up' {
@return '(min-width: #{$medium + 1})';
}
@else if $bp == 'large-up' {
@return '(min-width: #{$large + 1})';
}
@else if $bp == 'extra-large-up' {
@return '(min-width: #{$extra-large + 1})';
}
@else if $bp == 'retina' {
@return '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)';
}
}
@mixin respond-to($value) {
$string: breakpoint($value);
@media screen and #{$string} {
@content;
}
}