From 36a199fec2956c8cc36edc3c744e2c23c4d6a681 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Fri, 23 Feb 2018 00:29:27 +0100 Subject: [PATCH 1/2] fix: add the print media query for the right media query combinations --- scss/util/_breakpoint.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scss/util/_breakpoint.scss b/scss/util/_breakpoint.scss index 05cc9dd6b6..3264741c8a 100644 --- a/scss/util/_breakpoint.scss +++ b/scss/util/_breakpoint.scss @@ -147,8 +147,10 @@ $breakpoint-classes: (small medium large) !default; @for $i from 1 through length($values) { $value: nth($values, $i); $str: breakpoint($value); - $bp: index($-zf-breakpoints-keys, $value); + $bp: index($-zf-breakpoints-keys, nth($value, 1)); $pbp: index($-zf-breakpoints-keys, $print-breakpoint); + // Direction of media query (up, down, or only) + $dir: if(length($value) > 1, nth($value, 2), up); $old-zf-size: null; @@ -166,7 +168,7 @@ $breakpoint-classes: (small medium large) !default; // Otherwise, wrap the content in a media query @else { // For named breakpoints less than or equal to $print-breakpoint, add print to the media types - @if $bp != null and $bp <= $pbp { + @if ($bp != null and $bp == $pbp and ($dir == '' or $dir == 'up' or $dir == 'only')) or ($bp != null and $bp < $pbp and ($dir == '' or $dir == 'up')) or ($bp != null and $bp >= $pbp and ($dir == 'down')) { @media print, screen and #{$str} { @content; } From a3a6262570a3ff7ae5609c09d3495a5525f706fb Mon Sep 17 00:00:00 2001 From: Joe Workman Date: Thu, 5 Dec 2019 13:57:47 -0800 Subject: [PATCH 2/2] Simplified breakpoint print if logic as agree to generate print if the breakpoint affects the print-breakpoint (or smaller). This means the current condition only needs to be extended so 'down' always generates print. --- scss/util/_breakpoint.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scss/util/_breakpoint.scss b/scss/util/_breakpoint.scss index 3264741c8a..a0cebeee03 100644 --- a/scss/util/_breakpoint.scss +++ b/scss/util/_breakpoint.scss @@ -168,7 +168,9 @@ $breakpoint-classes: (small medium large) !default; // Otherwise, wrap the content in a media query @else { // For named breakpoints less than or equal to $print-breakpoint, add print to the media types - @if ($bp != null and $bp == $pbp and ($dir == '' or $dir == 'up' or $dir == 'only')) or ($bp != null and $bp < $pbp and ($dir == '' or $dir == 'up')) or ($bp != null and $bp >= $pbp and ($dir == 'down')) { + // generate print if the breakpoint affects the print-breakpoint (or smaller). + // This means the current condition only needs to be extended so 'down' always generates print. + @if $bp != null and ($bp <= $pbp or $dir == down) { @media print, screen and #{$str} { @content; }