diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ac0ef94e..21931c9218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,11 @@ For the full list of changes, see the [0.x.y] release notes. **Breaking changes**: +- **Appearance**: + - The **language menu** is now visible from the navbar on all screen sizes + ([#2303]). The menu is hidden from the sidebar by default. To restore the + legacy behavior, set `ui.sidebar_lang_menu` to `true` in your project's + config. For details see, [Adding a language menu][]. - **Shortcodes**: - The alert shortcode has been reworked to address [#906] and [#939]. It can now be used with Markdown content, and it can contain calls to other @@ -43,8 +48,12 @@ For the full list of changes, see the [0.x.y] release notes. - Hamburger menu toggle button icon changes to an X when the menu is expanded ([#2301]). This is a style change only. -[0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y [#2300]: https://github.com/google/docsy/pull/2300 +[#2301]: https://github.com/google/docsy/pull/2301 +[#2303]: https://github.com/google/docsy/pull/2303 +[0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y +[Adding a language menu]: + https://www.docsy.dev/docs/adding-content/navigation/#adding-a-language-drop-down ## 0.12.0 diff --git a/assets/scss/_nav.scss b/assets/scss/_nav.scss index 3986ee8b22..f1b7bf5418 100644 --- a/assets/scss/_nav.scss +++ b/assets/scss/_nav.scss @@ -46,7 +46,7 @@ } .navbar-nav { - padding-top: $spacer * 0.5; + // padding-top: $spacer * 0.5; white-space: nowrap; } @@ -69,10 +69,6 @@ .nav-item { padding-inline-end: $spacer * 0.5; } - - .navbar-nav { - padding-top: 0 !important; - } } @include media-breakpoint-down(lg) { @@ -88,12 +84,17 @@ } .navbar-nav { - padding-bottom: 2rem; + // padding-bottom: 2rem; overflow-x: auto; } } .td-light-dark-menu { + position: unset !important; + display: flex; + align-items: center; + justify-content: center; + .bi { // Adapted from: https://github.com/twbs/bootstrap/blob/main/site/layouts/_default/examples.html width: 1em; @@ -101,12 +102,55 @@ vertical-align: -.125em; fill: currentcolor; } + } + + .td-lang-menu { + position: unset !important; + display: flex; + align-items: center; + justify-content: center; + + &__title { + padding-left: 0; + padding-right: 0; + + &::before { + font: var(--fa-font-solid); + content: fa-content($fa-var-globe); + padding-right: 0.5rem; + } + + &-code { + display: none; + } - &.dropdown { @include media-breakpoint-down(lg) { - position: unset; + &-text { + display: none; + } + &-code { + display: inline; + } + &::before { + padding-right: 0; + } } } + + .dropdown-item { + position: relative; + padding-left: 2.5rem; + + &.active::before { + font: var(--fa-font-solid); + content: fa-content($fa-var-check); + position: absolute; + left: 0.75rem; + top: 50%; + transform: translateY(-50%); + } + } + } } diff --git a/assets/scss/_sidebar-tree.scss b/assets/scss/_sidebar-tree.scss index 45338f9309..037419f0b0 100644 --- a/assets/scss/_sidebar-tree.scss +++ b/assets/scss/_sidebar-tree.scss @@ -194,4 +194,14 @@ display: block; } } + + .td-lang-menu { + &__title { + padding-left: 0 !important; + &-code { + display: none; + } + + } + } } diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html index d25e217128..04a55e6f8f 100644 --- a/layouts/_partials/head.html +++ b/layouts/_partials/head.html @@ -6,7 +6,7 @@ {{ end -}} {{ $outputFormat := partial "outputformat.html" . -}} -{{ if and hugo.IsProduction (ne $outputFormat "print") -}} +{{ if and hugo.IsProduction (ne $outputFormat "print") (ne .Site.Language.Lang "xx") -}} {{ else -}} diff --git a/layouts/_partials/navbar-lang-selector.html b/layouts/_partials/navbar-lang-selector.html index 37ccc1139b..e8301e30d7 100644 --- a/layouts/_partials/navbar-lang-selector.html +++ b/layouts/_partials/navbar-lang-selector.html @@ -1,12 +1,35 @@ {{/* Link directly to documentation etc., if possible. */ -}} {{ $langPage := cond (gt (len .Translations) 0) . .Site.Home -}} -