Skip to content

Commit

Permalink
fix: use more specific media queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gfellerph committed Jul 24, 2024
1 parent 684693c commit 21b2718
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions packages/styles/src/mixins/_media.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@mixin min($device-size) {
@media screen and (min-width: $device-size) {
@content;
}
}

@mixin max($device-size) {
@media screen and (max-width: ($device-size - 0.1)) {
@content;
}
}

@mixin between($min-size, $max-size) {
@media screen and (min-width: $min-size) and (max-width: ($max-size - 0.1)) {
@content;
}
}
7 changes: 4 additions & 3 deletions packages/styles/src/tokens/semantic/_device.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

@use './core';
@use './../../mixins/tokens';
@use './../../mixins/media';

:root {
@media (max-width: 599.9px) {
@include media.max(600px) {
@include tokens.from(device.$post-mobile);
}

@media (min-width: 600px) {
@include media.between(600px, 1024px) {
@include tokens.from(device.$post-tablet);
}

@media (min-width: 1024px) {
@include media.min(1024px) {
@include tokens.from(device.$post-desktop);
}
}

0 comments on commit 21b2718

Please sign in to comment.