UI updated

This commit is contained in:
2026-10-07 14:05:39 -07:00
parent 945b0a1836
commit d6ec1f93b8
3 changed files with 54 additions and 184 deletions

View File

@@ -81,7 +81,7 @@ function buildThemeControls() {
seg.innerHTML = modes.map(function (m) {
return '<button type="button" data-mode="' + m + '" aria-label="' + m + '">' + icon(m) + "</button>";
}).join("");
links.appendChild(seg);
(document.querySelector("#sidebar .side-links") || links).appendChild(seg);
[menu, seg].forEach(function (el) {
el.addEventListener("click", function (e) {
var b = e.target.closest("button");
@@ -185,7 +185,9 @@ function buildMobileBar() {
var newSidebar = doc.querySelector("#sidebar");
if (newSidebar) {
var groups = newSidebar.querySelectorAll(".group");
var sideHead = sidebar.querySelector(".side-head");
sidebar.innerHTML = "";
if (sideHead) sidebar.appendChild(sideHead);
if (mobileTabs) sidebar.appendChild(mobileTabs);
groups.forEach(function (group) {
sidebar.appendChild(group.cloneNode(true));
@@ -202,6 +204,18 @@ function buildMobileBar() {
});
});
}
var head = document.createElement("div");
head.className = "side-head";
var brand = document.querySelector("#navbar .brand");
if (brand && sidebar) {
var b = brand.cloneNode(true);
b.querySelector("img").removeAttribute("id");
var sideLinks = document.createElement("div");
sideLinks.className = "side-links";
head.appendChild(b);
head.appendChild(sideLinks);
sidebar.insertBefore(head, sidebar.firstChild);
}
}
function addEyebrow() {

View File

@@ -1416,7 +1416,7 @@ html.dark .search-footer {
.mobile-tabs {
display: block;
margin-top: 50px;
margin-top: 8px;
}
body.nav-open #theme-seg {
@@ -1445,16 +1445,16 @@ html.dark .search-footer {
#sidebar {
position: fixed;
left: 0;
top: var(--sidebar-top, var(--header-height));
top: 0;
width: 80%;
max-width: 340px;
height: calc(100vh - var(--sidebar-top, var(--header-height)));
height: calc(100dvh - var(--sidebar-top, var(--header-height)));
padding: 20px 16px;
height: 100vh;
height: 100dvh;
padding: 0 16px 20px;
background: var(--bg-light);
transform: translateX(-100%);
transition: transform 0.2s ease;
z-index: 30;
z-index: 200;
}
html.dark #sidebar {
@@ -1498,4 +1498,37 @@ main.prose p {
main.prose p,
main.prose li {
line-height: 1.75;
}
.side-head {
display: none;
}
@media (max-width: 900px) {
.side-head {
display: flex;
align-items: center;
justify-content: space-between;
height: 60px;
margin: 0 -16px 12px;
padding: 0 20px;
}
#sidebar .side-head .brand {
display: flex;
align-items: center;
}
#sidebar .side-head .brand img {
height: 28px;
width: 28px;
border-radius: 50%;
display: block;
}
#sidebar .side-links {
display: flex;
align-items: center;
gap: 10px;
}
}