Skip to content

Commit

Permalink
fix: Fix document display on very narrow screens (#5080)
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert authored Feb 14, 2023
1 parent eaa7a7e commit 1e3c826
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion ietf/static/css/document_html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,58 @@ $tooltip-margin: inherit !default;
@import "bootstrap/scss/utilities";
@import "bootstrap/scss/root";

// from https://gist.github.com/Jakobud/a0ac11e80a1de453cd86f0d3fc0a1410?permalink_comment_id=2327765#gistcomment-2327765
@function map-sort-by-values($map) {
// Transform map to zipped list
$keys: ();
$values: ();

@each $key,
$val in $map {
$keys: append($keys, $key);
$values: append($values, $val);
}

$list: zip($keys, $values);
$sortedMap: ();

@while length($list)>0 {
// Find smallest pair
$smallestPair: nth($list, 1);

@each $pair in $list {
$value: nth($pair, 2);
$smallestValue: nth($smallestPair, 2);

@if $value < $smallestValue {
$smallestPair: $pair;
}
}

// Add smallest pair to sorted map
$key: nth($smallestPair, 1);
$value: nth($smallestPair, 2);
$sortedMap: map-merge($sortedMap, ($key: $value));

// Remove from list smallest pair
$smallestPairIndex: index($list, $smallestPair);
$newList: ();

@for $i from 1 through length($list) {
@if $i !=$smallestPairIndex {
$newList: append($newList, nth($list, $i), "space");
}
}

$list: $newList;
}

@return $sortedMap;
}

// add an xxs breakpoint for narrow devices
$grid-breakpoints: map-sort-by-values(map.merge($grid-breakpoints, (xxs: 0, xs: 400px)));

// Layout & components
@import "bootstrap/scss/reboot";
@import "bootstrap/scss/type";
Expand Down Expand Up @@ -108,7 +160,11 @@ $tooltip-margin: inherit !default;
}

@media screen {
@include media-breakpoint-only(xs) {
@include media-breakpoint-only(xxs) {
font-size: min(6pt, var(--doc-ptsize-max));
}

@include media-breakpoint-up(xs) {
font-size: min(7pt, var(--doc-ptsize-max));
}

Expand Down

0 comments on commit 1e3c826

Please sign in to comment.