Skip to content

Commit

Permalink
apply styles of half section when printing
Browse files Browse the repository at this point in the history
- add parameter to mq mixins to set styles for print
  • Loading branch information
janKollars committed Jun 21, 2020
1 parent 9aac391 commit 7ef700a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/assets/styles/components/_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
padding-top: $spacing-y;
padding-bottom: $spacing-y;

@include mq(md) {
@include mq(md, true) {
&--half {
grid-column: span 1;
}
Expand Down
16 changes: 12 additions & 4 deletions src/assets/styles/utils/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
// SCSS MIXINS
//--------------------

@mixin mq($name) {
/// Creates media query for breakpoint and bigger
///
/// @param {string} $name - The name of the breakpoint
/// @param {boolean} $print [false] - If the styles should also apply in print
@mixin mq($name, $print: false) {
$min: breakpoint-min($name, $breakpoints);
@if $min {
@media (min-width: $min) {
@media #{if($print, 'print, all ', 'all')} and (min-width: $min) {
@content;
}
} @else {
@content;
}
}

@mixin mq-down($name) {
/// Creates media query for smaller than breakpoint
///
/// @param {string} $name - The name of the breakpoint
/// @param {boolean} $print [false] - If the styles should also apply in print
@mixin mq-down($name, $print: false) {
$min: breakpoint-min($name, $breakpoints);
@if $min {
@media (max-width: ($min - 1px)) {
@media #{if($print, 'print, all ', 'all')} and (max-width: ($min - 1px)) {
@content;
}
} @else {
Expand Down

0 comments on commit 7ef700a

Please sign in to comment.