Skip to content

Commit

Permalink
feat: stop shrinking of small type on larger viewports (#21)
Browse files Browse the repository at this point in the history
because:
- when the font-size ratio is increased on larger viewports,
the large type gets larger, but the small type is getting
smaller, which is not what we want

this commit:
- stops the shrinking of smaller type (i.e. smaller than the base
font-size) on larger viewports, when the ratio is changed

docs: document if condition (#21)
  • Loading branch information
csshugs committed Feb 3, 2020
1 parent e6a3be6 commit 4ae74f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
9 changes: 7 additions & 2 deletions src/generic/_generic.ms-custom-properties.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
@if (unit($key) == "px") {
@media screen and (min-width: $key) {
@each $scale in map-get($FLUIDMS-CONFIG, scales) {
--ms#{$scale}-ratio: #{fluidms-pow(map-get($value, ratio), $scale)};
--ms#{$scale}-line-height: #{fluidms-line-height($scale, map-get($value, ratio))};
// Exclude all the scales that are smaller than the
// base font-size, so that small type will not get
// smaller on larger viewports (#21).
@if not (str-index(#{$scale}, "-")) {
--ms#{$scale}-ratio: #{fluidms-pow(map-get($value, ratio), $scale)};
--ms#{$scale}-line-height: #{fluidms-line-height($scale, map-get($value, ratio))};
}
}
}
}
Expand Down
16 changes: 2 additions & 14 deletions test/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@
--ms1-ratio: 1.2;
--ms1-line-height: 1.75rem;
--ms0-ratio: 1;
--ms0-line-height: 1.5rem;
--ms-1-ratio: 0.83333;
--ms-1-line-height: 1.25rem;
--ms-2-ratio: 0.69444;
--ms-2-line-height: 1rem;
--ms-3-ratio: 0.5787;
--ms-3-line-height: 0.75rem; } }
--ms0-line-height: 1.5rem; } }
@media screen and (min-width: 1280px) {
:root {
--ms6-ratio: 4.82681;
Expand All @@ -63,13 +57,7 @@
--ms1-ratio: 1.3;
--ms1-line-height: 1.75rem;
--ms0-ratio: 1;
--ms0-line-height: 1.5rem;
--ms-1-ratio: 0.76923;
--ms-1-line-height: 1rem;
--ms-2-ratio: 0.59172;
--ms-2-line-height: 0.75rem;
--ms-3-ratio: 0.45517;
--ms-3-line-height: 0.5rem; } }
--ms0-line-height: 1.5rem; } }

/*------------------------------------*\
#PAGE
Expand Down
2 changes: 0 additions & 2 deletions test/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ html {
);
}

$h1-font-size: ms(6) !default;

h1 {
@include fluidms-font-size(
$font-size: ms(6)
Expand Down

0 comments on commit 4ae74f1

Please sign in to comment.