From 606c2be4255f2e78ac9205970fde186d1320070b Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Tue, 11 Jun 2024 15:02:22 -0700 Subject: [PATCH] Improve docs header style (#2516) * refactor: pattern to separate file causes a lot of lag and also probably isn't the best to inline since we have scss preprocessing * fix: escape quotes properly * feat: improve header styles --- docs/sass/_base.scss | 4 +++- docs/sass/_header.scss | 14 +++++++++++--- docs/sass/_layout.scss | 22 +++++++++++++++++++--- docs/sass/_pattern.scss | 1 + docs/sass/_search.scss | 10 +++++++++- docs/templates/index.html | 31 ++++++++++++++++--------------- 6 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 docs/sass/_pattern.scss diff --git a/docs/sass/_base.scss b/docs/sass/_base.scss index eec9e7a7..e6796e22 100644 --- a/docs/sass/_base.scss +++ b/docs/sass/_base.scss @@ -1,3 +1,5 @@ +@import "pattern"; + html, body { font-size: 16px; height: 100%; @@ -8,7 +10,7 @@ body { line-height: 1.6; // from http://www.heropatterns.com background-color: #191919; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%234b4b4b' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-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); + background-image: $grid-pattern; color: $foreground; diff --git a/docs/sass/_header.scss b/docs/sass/_header.scss index 699e025a..034c0863 100644 --- a/docs/sass/_header.scss +++ b/docs/sass/_header.scss @@ -3,8 +3,15 @@ header { border-bottom: none; } - nav a { - margin-right: 2rem; + ul { + padding-inline-start: 0; + display: flex; + gap: 1ch 2rem; + margin: 0; + } + + li { + list-style: none; } .header__logo { @@ -27,7 +34,8 @@ header { .header__logo { // to force menu links to be on a line below - display: block; + text-align: center; + width: 100%; } } } diff --git a/docs/sass/_layout.scss b/docs/sass/_layout.scss index c917f7fe..802f1ce7 100644 --- a/docs/sass/_layout.scss +++ b/docs/sass/_layout.scss @@ -1,5 +1,20 @@ header { padding: 2rem 3rem; + display: flex; + flex-wrap: wrap; + align-items: baseline; + column-gap: 2rem; + + // Container is reused elsewhere, so this must be declared here + nav { + display: flex; + flex-grow: 1; + flex-wrap: wrap; + align-items: baseline; + justify-content: center; + gap: 1rem 2rem; + margin: 0; + } } .container { @@ -7,9 +22,11 @@ header { margin: 0 auto; } -@media only screen and (max-width: 1000px) { - .container { +@media only screen and (max-width: 1000px) { + header { max-width: 90%; + margin-inline: auto; + justify-content: center; } } @@ -22,7 +39,6 @@ header { } } - footer { text-align: center; padding: 2rem 3rem; diff --git a/docs/sass/_pattern.scss b/docs/sass/_pattern.scss new file mode 100644 index 00000000..c1c62926 --- /dev/null +++ b/docs/sass/_pattern.scss @@ -0,0 +1 @@ +$grid-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%234b4b4b' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H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v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); diff --git a/docs/sass/_search.scss b/docs/sass/_search.scss index f1ffb70e..31f80eb6 100644 --- a/docs/sass/_search.scss +++ b/docs/sass/_search.scss @@ -1,7 +1,9 @@ .search-container { display: inline-block; position: relative; - width: 300px; + width: 100%; + max-width: 300px; + margin-left: auto; input { width: 100%; @@ -45,3 +47,9 @@ } } } + +@media only screen and (max-width: 1000px) { + .search-container { + margin-left: 0; + } +} diff --git a/docs/templates/index.html b/docs/templates/index.html index b232934c..a202178f 100644 --- a/docs/templates/index.html +++ b/docs/templates/index.html @@ -7,19 +7,20 @@ {% block title %}{{ config.title }}{% endblock title %} - - + +
-