Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add the print media query for the right media query combinations #10979

Merged
merged 2 commits into from Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scss/util/_breakpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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));
joeworkman marked this conversation as resolved.
Show resolved Hide resolved
$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;

Expand All @@ -166,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 {
// 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;
}
Expand Down