Skip to content

Commit

Permalink
Add ability use operators with mq helper (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
bameyrick authored and jrbarnes9 committed Feb 20, 2019
1 parent 702acc2 commit 18c9410
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/summary/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $summary-col-spacing: 1rem;
}
}

@include mq(xs, m) {
@include mq(xs, m, $to-operator: '<') {
&__items,
&__item,
&__item-title,
Expand Down
14 changes: 13 additions & 1 deletion src/scss/helpers/_mq.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mixin mq($from: none, $to: none) {
@mixin mq($from: none, $to: none, $from-operator: none, $to-operator: none) {
@if $from != none and type-of($from) == 'string' {
$from: get-bp-width($from);
}
Expand All @@ -11,14 +11,26 @@
@if ($from == none or $from <= nth(nth($grid-bp, 1), 2)) and $to == none {
@content;
} @else if $from == none or $from <= nth(nth($grid-bp, 1), 2) {
@if $to-operator != none and $to-operator == '<' {
$to: $to - 1;
}
@media only screen and (max-width: $to) {
@content;
}
} @else if $to == none {
@if $from-operator != none and $from-operator == '<' {
$from: $from + 1;
}
@media only screen and (min-width: $from) {
@content;
}
} @else {
@if $from-operator != none and $from-operator == '<' {
$from: $from + 1;
}
@if $to-operator != none and $to-operator == '<' {
$to: $to - 1;
}
@media only screen and (min-width: $from) and (max-width: $to) {
@content;
}
Expand Down

0 comments on commit 18c9410

Please sign in to comment.