From df51beefe54dba1f15943f0f6e67d8273aeda171 Mon Sep 17 00:00:00 2001 From: Daniela Rus Morales Date: Sat, 10 Aug 2024 07:52:31 +0200 Subject: [PATCH 1/2] Fix CSS issues in small form-factor --- ChangeLog.md | 4 ++ scss/_layout.scss | 14 ++++- scss/components/_admonitions.scss | 85 +++++++++++++++++++++++++++++++ sphinx_nefertiti/layout.html | 4 +- sphinx_nefertiti/pager.html | 6 +-- 5 files changed, 107 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 1f138cf..26c7be0 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Change Log +## [0.4.1] - 2024-08-10 + +- Fix various UI/CSS issues in small form factors. + ## [0.4.0] - 2024-08-05 - Move `pygments_light_style` and `pygments_dark_style` options inside theme options (`html_theme_options`), as `pygments_dark_style` is no longer a valid config setting in `app.config` by Sphinx. Update docs accordingly. diff --git a/scss/_layout.scss b/scss/_layout.scss index 120d169..dfd79a4 100644 --- a/scss/_layout.scss +++ b/scss/_layout.scss @@ -39,7 +39,7 @@ body { display: grid; grid-template-areas: "content toc"; grid-template-columns: minmax(570px, 5fr) minmax(190px, 1fr); - gap: 25px; + gap: 18px; } @include media-breakpoint-down(lg) { @@ -51,6 +51,13 @@ body { grid-template-columns: 100%; max-width: 892px; margin-inline: auto; + margin-top: 1.5rem; + } + + @include media-breakpoint-down(sm) { + row-gap: 0; + column-gap: 18px; + margin-top: 0; } } @@ -70,6 +77,11 @@ body { max-width: 92%; margin-inline: auto; } + + @include media-breakpoint-down(sm) { + max-width: 100%; + margin-top: 1.5rem; + } } .nftt-sidebar { diff --git a/scss/components/_admonitions.scss b/scss/components/_admonitions.scss index a7670fc..a7e7dc6 100644 --- a/scss/components/_admonitions.scss +++ b/scss/components/_admonitions.scss @@ -7,6 +7,10 @@ border: 2px solid var(--#{$prefix}admon-tip-color-bg); border-radius: $border-radius; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem 2rem; + } + .added, .versionmodified { position: relative; @@ -20,6 +24,12 @@ font-weight: $font-weight-bold; color: var(--#{$prefix}body-hc-color); background-color: var(--#{$prefix}admon-tip-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + margin: -1rem 0; + border-radius: $border-radius; + } } > p:first-child { @@ -34,6 +44,10 @@ border: 2px solid var(--#{$prefix}admon-caution-color-bg); border-radius: $border-radius; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem 2rem; + } + .changed, .versionmodified { position: relative; @@ -47,6 +61,12 @@ font-weight: $font-weight-bold; color: var(--#{$prefix}body-hc-color); background-color: var(--#{$prefix}admon-caution-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + margin: -1rem 0; + border-radius: $border-radius; + } } > p:first-child { @@ -61,6 +81,10 @@ div.deprecated { border: 2px solid var(--#{$prefix}admon-error-color-bg); border-radius: $border-radius; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem 2rem; + } + span.deprecated, span.versionmodified { position: relative; @@ -74,6 +98,12 @@ div.deprecated { font-weight: $font-weight-bold; color: var(--#{$prefix}body-hc-color); background-color: var(--#{$prefix}admon-error-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + margin: -1rem 0; + border-radius: $border-radius; + } } > p:first-child { @@ -88,6 +118,10 @@ div.versionremoved { border: 2px solid var(--#{$prefix}admon-attention-color-bg); border-radius: $border-radius; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem 2rem; + } + span.removed, span.versionmodified { position: relative; @@ -101,6 +135,12 @@ div.versionremoved { font-weight: $font-weight-bold; color: var(--#{$prefix}body-hc-color); background-color: var(--#{$prefix}admon-attention-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + margin: -1rem 0; + border-radius: $border-radius; + } } > p:first-child { @@ -113,6 +153,10 @@ div.versionremoved { margin: 2.5rem 2rem; border: 2px solid transparent; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem; + } + > p { margin-bottom: 0; } @@ -129,6 +173,11 @@ div.versionremoved { margin: -1rem; font-weight: $font-weight-bold; background-color: var(--#{$prefix}admon-tip-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + border-radius: $border-radius; + } } } @@ -137,6 +186,10 @@ div.versionremoved { margin: 2.5rem 2rem; border: 2px solid transparent; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem; + } + > p { margin-bottom: 0; } @@ -153,6 +206,11 @@ div.versionremoved { margin: -1rem; font-weight: $font-weight-bold; background-color: var(--#{$prefix}admon-caution-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + border-radius: $border-radius; + } } } @@ -161,6 +219,10 @@ div.deprecated-title-only { margin: 2.5rem 2rem; border: 2px solid transparent; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem; + } + > p { margin-bottom: 0; } @@ -177,6 +239,11 @@ div.deprecated-title-only { margin: -1rem; font-weight: $font-weight-bold; background-color: var(--#{$prefix}admon-error-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + border-radius: $border-radius; + } } } @@ -185,6 +252,10 @@ div.deprecated-title-only { margin: 2.5rem 2rem; border: 2px solid transparent; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem; + } + > p { margin-bottom: 0; } @@ -201,6 +272,11 @@ div.deprecated-title-only { margin: -1rem; font-weight: $font-weight-bold; background-color: var(--#{$prefix}admon-attention-color-bg); + + @include media-breakpoint-down(sm) { + left: 0; + border-radius: $border-radius; + } } } @@ -218,6 +294,11 @@ aside.topic > .topic-title { color: var(--#{$prefix}body-hc-color); background-color: var(--#{$prefix}admon-note-color-bg); + @include media-breakpoint-down(sm) { + left: 6px; + border-radius: $border-radius; + } + &::before { display: inline-block; width: 16px; @@ -240,6 +321,10 @@ aside.topic { border: 2px solid var(--#{$prefix}admon-note-color-bg); border-radius: $border-radius; + @include media-breakpoint-down(sm) { + margin: 2.5rem .6rem 2rem; + } + .admonition-title, .topic-title { color: var(--#{$prefix}body-hc-color); diff --git a/sphinx_nefertiti/layout.html b/sphinx_nefertiti/layout.html index 090a7c4..b6a21af 100644 --- a/sphinx_nefertiti/layout.html +++ b/sphinx_nefertiti/layout.html @@ -216,9 +216,9 @@ {%- block body %} {% endblock -%} -