fix menu responsive layout
This commit is contained in:
parent
da11416b39
commit
84576f2c29
4 changed files with 94 additions and 58 deletions
|
@ -66,13 +66,16 @@
|
||||||
</a>
|
</a>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<nav>
|
<nav>
|
||||||
<details>
|
<div class="logo">
|
||||||
<summary aria-label="{{ t "menu.title" }}">
|
<a aria-label="{{ t "menu.home_page" }}" href="{{ route .user.DefaultHomePage }}">
|
||||||
<div class="logo"><a aria-label="{{ t "menu.home_page" }}" href="{{ route .user.DefaultHomePage }}">Mini<span>flux</span></a></div>
|
Mini<span>flux</span>
|
||||||
|
</a>
|
||||||
|
<button aria-controls="header-menu" aria-expanded="false" aria-label="{{ t "menu.title" }}">
|
||||||
<svg aria-label="{{ t "menu.title" }}" xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
|
<svg aria-label="{{ t "menu.title" }}" xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/>
|
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/>
|
||||||
</svg>
|
</svg>
|
||||||
</summary>
|
</button>
|
||||||
|
</div>
|
||||||
<ul id="header-menu">
|
<ul id="header-menu">
|
||||||
<li {{ if eq .menu "unread" }}class="active"{{ end }} title="{{ t "tooltip.keyboard_shortcuts" "g u" }}">
|
<li {{ if eq .menu "unread" }}class="active"{{ end }} title="{{ t "tooltip.keyboard_shortcuts" "g u" }}">
|
||||||
<a href="{{ route "unread" }}" data-page="unread">{{ t "menu.unread" }}
|
<a href="{{ route "unread" }}" data-page="unread">{{ t "menu.unread" }}
|
||||||
|
@ -109,14 +112,14 @@
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
|
||||||
</nav>
|
</nav>
|
||||||
<search role="search" class="search">
|
<search role="search" class="search">
|
||||||
<details {{ if $.searchQuery }}open{{ end }}>
|
<details {{ if $.searchQuery }}open{{ end }}>
|
||||||
<summary>{{ t "search.label" }}</summary>
|
<summary>
|
||||||
|
<span id="search-label">{{ t "search.label" }}</span>
|
||||||
|
</summary>
|
||||||
<form action="{{ route "searchEntries" }}" aria-labelledby="search-input-label">
|
<form action="{{ route "searchEntries" }}" aria-labelledby="search-input-label">
|
||||||
<label class="sr-only" for="search-input" id="search-input-label">{{ t "search.label" }}</label>
|
<input type="search" name="q" aria-labelledby="search-label" {{ if $.searchQuery }}value="{{ .searchQuery }}"{{ end }} required>
|
||||||
<input type="search" name="q" id="search-input" {{ if $.searchQuery }}value="{{ .searchQuery }}"{{ end }} required>
|
|
||||||
<button type="submit">{{ t "search.submit" }}</button>
|
<button type="submit">{{ t "search.submit" }}</button>
|
||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -91,25 +91,31 @@ a:hover {
|
||||||
|
|
||||||
.header nav {
|
.header nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: stretch;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header nav details {
|
.header nav button[aria-controls="header-menu"] {
|
||||||
flex: 1;
|
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;
|
rotate: 180deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header nav summary {
|
.header ul.js-menu-show {
|
||||||
list-style: none;
|
display: initial;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
}
|
||||||
.header nav summary::-webkit-details-marker {
|
|
||||||
|
.header ul:not(.js-menu-show) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,11 +193,15 @@ a:hover {
|
||||||
.logo {
|
.logo {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo a {
|
.logo a {
|
||||||
color: var(--logo-color);
|
color: var(--logo-color);
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo a:hover {
|
.logo a:hover {
|
||||||
|
@ -297,6 +307,27 @@ a:hover {
|
||||||
font-size: 1.0em;
|
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-header li,
|
||||||
.page-footer li {
|
.page-footer li {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
|
|
@ -27,13 +27,14 @@ function onAuxClick(selector, callback, noPreventDefault) {
|
||||||
|
|
||||||
// Show and hide the main menu on mobile devices.
|
// Show and hide the main menu on mobile devices.
|
||||||
function toggleMainMenu() {
|
function toggleMainMenu() {
|
||||||
|
console.log("clc")
|
||||||
let menu = document.querySelector(".header nav ul");
|
let menu = document.querySelector(".header nav ul");
|
||||||
let menuToggleButton = document.querySelector(".header .logo a");
|
let menuToggleButton = document.querySelector(".header button[aria-controls='header-menu']");
|
||||||
if (DomHelper.isVisible(menu)) {
|
if (menu.classList.contains("js-menu-show")) {
|
||||||
menu.style.display = "none";
|
menu.classList.remove("js-menu-show")
|
||||||
menuToggleButton.setAttribute("aria-expanded", false)
|
menuToggleButton.setAttribute("aria-expanded", false)
|
||||||
} else {
|
} else {
|
||||||
menu.style.display = "block";
|
menu.classList.add("js-menu-show")
|
||||||
menuToggleButton.setAttribute("aria-expanded", true)
|
menuToggleButton.setAttribute("aria-expanded", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
internal/ui/static/js/bootstrap.js
vendored
1
internal/ui/static/js/bootstrap.js
vendored
|
@ -112,6 +112,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
onClick("button[aria-controls='header-menu']", () => toggleMainMenu());
|
||||||
if (document.documentElement.clientWidth < 600) {
|
if (document.documentElement.clientWidth < 600) {
|
||||||
onClick(".header nav li", (event) => onClickMainMenuListItem(event));
|
onClick(".header nav li", (event) => onClickMainMenuListItem(event));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue