Docs UI: Style the currently active nav link

This commit is contained in:
Mfon Eti-mfon 2022-07-04 04:18:12 +01:00
parent d2dbb0001a
commit 33a6c9e6c5
No known key found for this signature in database
GPG key ID: C79D87B2D3688E26
2 changed files with 9 additions and 2 deletions

View file

@ -14,7 +14,10 @@
sidebar.querySelectorAll(".sidebar-entry").forEach((entry) => {
let entryName = entry.querySelector('.sidebar-module-link').textContent;
if (currentModuleName === entryName) return;
if (currentModuleName === entryName) {
entry.firstChild.classList.add("active");
return;
};
entry.querySelectorAll(".sidebar-sub-entries a").forEach((subEntry) => subEntry.classList.add("hidden"));
})
} else {
@ -41,4 +44,4 @@
searchBox.addEventListener("input", search);
search();
})();
})();