// Media query for minimum resolution @mixin if-min($min) { @media only screen and (min-width: $min) { @content; } } // Media query for maximum resolution @mixin if-max($max) { @media only screen and (max-width: $max) { @content; } } // Media query for between minimum and maximum resolution @mixin if-min-max($min, $max) { @media only screen and (min-width: $min) and (max-width: $max) { @content; } } // Media query for landscape orientation detection @mixin if-landscape { @media only screen and (orientation: landscape) { @content; } } // Media query for portrait orientation detection @mixin if-portrait { @media only screen and (orientation: portrait) { @content; } } // Media query for retina / HD displays @mixin if-retina { @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { @content; } } // Either support desktop-first or mobile-first responsive pattern @mixin do-responsive($desktop, $mobile) { @if $responsive-design == "desktop" { @if $desktop { @include if-max($desktop) { @content; } } @else { @content; } } @else { @if $mobile { @include if-min($mobile) { @content; } } @else { @content; } } } //-------------------- Breakpoints --------------------// // Uses min or max @mixin if-desktop { @include do-responsive(null, $breakpoint-tablet-landscape) { @content; } } @mixin if-tablet-landscape { @include do-responsive($breakpoint-tablet-landscape, $breakpoint-tablet-portrait) { @content; } } @mixin if-tablet-portrait { @include do-responsive($breakpoint-tablet-portrait, $breakpoint-mobile-landscape) { @content; } } @mixin if-mobile-landscape { @include do-responsive($breakpoint-mobile-landscape, $breakpoint-mobile-portrait) { @content; } } @mixin if-mobile-portrait { @include do-responsive($breakpoint-mobile-portrait, null) { @content; } } @mixin if-large() { @include do-responsive($breakpoint-large, $breakpoint-medium) { @content; } } @mixin if-medium() { @include do-responsive($breakpoint-medium, $breakpoint-small) { @content; } } @mixin if-small() { @include do-responsive($breakpoint-small, null) { @content; } } // Within 2 ranges @mixin in-desktop { @include if-min($breakpoint-tablet-landscape + 1) { @content; } } @mixin in-tablet { @include if-min-max($breakpoint-mobile-landscape + 1, $breakpoint-tablet-landscape) { @content; } } @mixin in-mobile { @include if-max($breakpoint-mobile-landscape) { @content; } } @mixin in-large { @include if-min($breakpoint-medium + 1) { @content; } } @mixin in-medium { @include if-min-max($breakpoint-small + 1, $breakpoint-medium) { @content; } } @mixin in-small { @include if-max($breakpoint-small) { @content; } }