2016-05-03 06:42:54 +08:00
|
|
|
// We use these functions to get the ranges for the media queries variables.
|
2018-10-19 04:37:14 +08:00
|
|
|
@function lower-bound($range) {
|
2016-05-03 06:42:54 +08:00
|
|
|
@if length($range) <= 0 {
|
|
|
|
@return 0;
|
|
|
|
}
|
|
|
|
@return nth($range,1);
|
|
|
|
}
|
|
|
|
|
|
|
|
@function upper-bound($range) {
|
|
|
|
@if length($range) < 2 {
|
|
|
|
@return 999999999999;
|
|
|
|
}
|
|
|
|
@return nth($range, 2);
|
|
|
|
}
|
|
|
|
|
2018-01-19 01:41:52 +08:00
|
|
|
$xsmall-range: (0em, 25.937em);
|
|
|
|
/* 0px, 415px */
|
|
|
|
$small-range: (26em, 40em);
|
|
|
|
/* 416px, 640px */
|
2016-05-03 06:42:54 +08:00
|
|
|
$medium-range: (40.063em, 64em);
|
|
|
|
/* 641px, 1024px */
|
|
|
|
$large-range: (64.063em, 90em);
|
|
|
|
/* 1025px, 1440px */
|
|
|
|
$xlarge-range: (90.063em, 120em);
|
|
|
|
/* 1441px, 1920px */
|
|
|
|
$xxlarge-range: (120.063em);
|
|
|
|
/* 1921px */
|
|
|
|
|
|
|
|
$screen: "only screen";
|
|
|
|
$landscape: "#{$screen} and (orientation: landscape)";
|
|
|
|
$portrait: "#{$screen} and (orientation: portrait)";
|
2018-01-10 05:13:31 +08:00
|
|
|
$xsmall-only: "#{$screen} and (min-width:#{lower-bound($xsmall-range)}) and (max-width:#{upper-bound($xsmall-range)})";
|
2018-10-19 04:37:14 +08:00
|
|
|
$small-up: "#{$screen} and (min-width:#{lower-bound($small-range)})";
|
2018-04-09 22:39:27 +08:00
|
|
|
$small-only: "#{$screen} and (max-width: #{upper-bound($small-range)})";
|
2016-05-03 06:42:54 +08:00
|
|
|
$medium-up: "#{$screen} and (min-width:#{lower-bound($medium-range)})";
|
|
|
|
$medium-only: "#{$screen} and (min-width:#{lower-bound($medium-range)}) and (max-width:#{upper-bound($medium-range)})";
|
|
|
|
$large-up: "#{$screen} and (min-width:#{lower-bound($large-range)})";
|
|
|
|
$large-only: "#{$screen} and (min-width:#{lower-bound($large-range)}) and (max-width:#{upper-bound($large-range)})";
|
|
|
|
$xlarge-up: "#{$screen} and (min-width:#{lower-bound($xlarge-range)})";
|
|
|
|
$xlarge-only: "#{$screen} and (min-width:#{lower-bound($xlarge-range)}) and (max-width:#{upper-bound($xlarge-range)})";
|
|
|
|
$xxlarge-up: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)})";
|
|
|
|
$xxlarge-only: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)}) and (max-width:#{upper-bound($xxlarge-range)})";
|
|
|
|
|
2018-10-26 09:40:15 +08:00
|
|
|
$hasPhoneDimentions: "#{$screen} and (max-height: 479px), #{$screen} and (max-width: 479px)";
|
2019-11-29 23:19:48 +08:00
|
|
|
$phone-landscape: "#{$screen} and (max-width: 480px) and (orientation: landscape)";
|
2018-09-09 13:23:33 +08:00
|
|
|
|
2019-03-20 01:51:21 +08:00
|
|
|
//Breakpoints used for permissions-overlay as relative units are not scalling properly on safari
|
2019-03-26 00:44:55 +08:00
|
|
|
$safari1280: "#{$screen} and (max-height: 1280px), #{$screen} and (max-width: 800px)";
|
|
|
|
$safari1440: "#{$screen} and (max-height: 1440px), #{$screen} and (max-width: 900px)";
|
|
|
|
$safari1680: "#{$screen} and (max-height: 1680px), #{$screen} and (max-width: 1050px)";
|
|
|
|
$safari1920: "#{$screen} and (max-height: 1920px), #{$screen} and (max-width: 1080px)";
|
2019-03-20 01:51:21 +08:00
|
|
|
|
2016-05-03 06:42:54 +08:00
|
|
|
$breakpoints: (
|
|
|
|
'screen': $screen,
|
|
|
|
'landscape': $landscape,
|
|
|
|
'portrait': $portrait,
|
|
|
|
'small': $small-only,
|
2018-01-10 05:13:31 +08:00
|
|
|
'xsmall': $xsmall-only,
|
2016-05-03 06:42:54 +08:00
|
|
|
'medium': $medium-only,
|
|
|
|
'large': $large-only,
|
|
|
|
'xlarge': $xlarge-only,
|
|
|
|
'xxlarge': $xxlarge-only,
|
2019-11-29 23:19:48 +08:00
|
|
|
'phoneLandscape': $phone-landscape,
|
2016-05-03 06:42:54 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
@mixin mq($media) {
|
|
|
|
// If the key exists in the map
|
|
|
|
@if map-has-key($breakpoints, $media) {
|
|
|
|
// Prints a media query based on the value
|
|
|
|
@media #{map-get($breakpoints, $media)} {
|
2018-10-19 04:37:14 +08:00
|
|
|
@content;
|
2016-05-03 06:42:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the key doesn't exist in the map we create a media with the argument
|
|
|
|
@else {
|
|
|
|
@media #{$media} {
|
2018-10-19 04:37:14 +08:00
|
|
|
@content;
|
2016-05-03 06:42:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|