docs: Add more design polish (#43802)

Fixing the theme toggle popover, search results design, and
sidebar/table of contents responsiveness.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal
2025-11-29 12:22:45 -03:00
committed by GitHub
parent 8abf1d35be
commit dd9cc90de9
5 changed files with 17 additions and 59 deletions
-25
View File
@@ -49,9 +49,6 @@ if (typeof requestIdleCallback === "function") {
function darkModeToggle() {
var html = document.documentElement;
var themeToggleButton = document.getElementById("theme-toggle");
var themePopup = document.getElementById("theme-list");
var themePopupButtons = themePopup.querySelectorAll("button");
function setTheme(theme) {
html.setAttribute("data-theme", theme);
@@ -60,28 +57,6 @@ function darkModeToggle() {
localStorage.setItem("mdbook-theme", theme);
}
themeToggleButton.addEventListener("click", function (event) {
event.preventDefault();
themePopup.style.display =
themePopup.style.display === "block" ? "none" : "block";
});
themePopupButtons.forEach(function (button) {
button.addEventListener("click", function () {
setTheme(this.id);
themePopup.style.display = "none";
});
});
document.addEventListener("click", function (event) {
if (
!themePopup.contains(event.target) &&
!themeToggleButton.contains(event.target)
) {
themePopup.style.display = "none";
}
});
// Set initial theme
var currentTheme = localStorage.getItem("mdbook-theme");
if (currentTheme) {