Skip to content

Commit

Permalink
refactor between() media query helper
Browse files Browse the repository at this point in the history
  • Loading branch information
joecritch committed Sep 19, 2017
1 parent 7e7ee1c commit 5e4dda9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions www/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ type Size = $Keys<typeof SIZES>;

const media = {
between(smallKey: Size, largeKey: Size, excludeLarge: Boolean = false) {
if (SIZES[largeKey].max === Infinity && !excludeLarge) {
return `@media (min-width: ${SIZES[smallKey].min}px)`;
if (excludeLarge) {
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].min - 1}px)`;
} else {
if (excludeLarge) {
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].min - 1}px)`;
if (SIZES[largeKey].max === Infinity) {
return `@media (min-width: ${SIZES[smallKey].min}px)`;
} else {
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].max}px)`;
}
Expand Down

0 comments on commit 5e4dda9

Please sign in to comment.