diff --git a/internal/template/templates/common/layout.html b/internal/template/templates/common/layout.html index 4110bf9c..50cab8a7 100644 --- a/internal/template/templates/common/layout.html +++ b/internal/template/templates/common/layout.html @@ -66,57 +66,60 @@
+ - + {{ end }} +
- {{ t "search.label" }} + + {{ t "search.label" }} +
- - +
diff --git a/internal/ui/static/css/common.css b/internal/ui/static/css/common.css index 0f578e7b..82dd88c9 100644 --- a/internal/ui/static/css/common.css +++ b/internal/ui/static/css/common.css @@ -91,25 +91,31 @@ a:hover { .header nav { display: flex; - align-items: center; + align-items: stretch; + flex-direction: column; } -.header nav details { - flex: 1; +.header nav button[aria-controls="header-menu"] { + border: none; + background-color: transparent; + display: inline-block; } -.header nav details[open] svg { +.header nav button[aria-controls="header-menu"] svg { + padding: 5px; + inline-size: 20px; + block-size: 20px; +} + +.header nav button[aria-controls="header-menu"][aria-expanded="true"] svg { rotate: 180deg; } -.header nav summary { - list-style: none; - display: flex; - align-items: center; - justify-content: center; - gap: 5px; +.header ul.js-menu-show { + display: initial; } -.header nav summary::-webkit-details-marker { + +.header ul:not(.js-menu-show) { display: none; } @@ -187,11 +193,15 @@ a:hover { .logo { cursor: pointer; text-align: center; + display: flex; + justify-content: center; } .logo a { color: var(--logo-color); letter-spacing: 1px; + display: flex; + align-items: center; } .logo a:hover { @@ -297,6 +307,27 @@ a:hover { font-size: 1.0em; } + .header nav { + align-items: start; + flex-direction: row; + } + + .header nav button[aria-controls="header-menu"] svg { + display: none; + } + + .header nav button[aria-controls="header-menu"] svg { + rotate: -90deg; + } + + .header nav button[aria-controls="header-menu"][aria-expanded="true"] svg { + rotate: 90deg; + } + + .header ul:not(.js-menu-show), .header ul.js-menu-show { + display: revert; + } + .page-header li, .page-footer li { display: inline; diff --git a/internal/ui/static/js/app.js b/internal/ui/static/js/app.js index 5ac29fa4..39a77c8e 100644 --- a/internal/ui/static/js/app.js +++ b/internal/ui/static/js/app.js @@ -27,13 +27,14 @@ function onAuxClick(selector, callback, noPreventDefault) { // Show and hide the main menu on mobile devices. function toggleMainMenu() { + console.log("clc") let menu = document.querySelector(".header nav ul"); - let menuToggleButton = document.querySelector(".header .logo a"); - if (DomHelper.isVisible(menu)) { - menu.style.display = "none"; + let menuToggleButton = document.querySelector(".header button[aria-controls='header-menu']"); + if (menu.classList.contains("js-menu-show")) { + menu.classList.remove("js-menu-show") menuToggleButton.setAttribute("aria-expanded", false) } else { - menu.style.display = "block"; + menu.classList.add("js-menu-show") menuToggleButton.setAttribute("aria-expanded", true) } } diff --git a/internal/ui/static/js/bootstrap.js b/internal/ui/static/js/bootstrap.js index 3c815f2b..dc23ada7 100644 --- a/internal/ui/static/js/bootstrap.js +++ b/internal/ui/static/js/bootstrap.js @@ -112,6 +112,7 @@ document.addEventListener("DOMContentLoaded", () => { } }, true); + onClick("button[aria-controls='header-menu']", () => toggleMainMenu()); if (document.documentElement.clientWidth < 600) { onClick(".header nav li", (event) => onClickMainMenuListItem(event)); }