Skip to content

Commit

Permalink
Update Sidebars visibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
XQuestCode committed Dec 30, 2023
1 parent 3e3c48b commit 3b210ec
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/Sidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ const { sidebar } = Astro.props;
}

<script is:inline>
function capitalizeEachWord(str) {
return str
.split(" ")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");
}

(() => {
const sidebarContent =
document.getElementById("starlight__sidebar")?.firstElementChild;
Expand All @@ -45,13 +40,7 @@ function capitalizeEachWord(str) {
return [...detailsElements];
}
const detailElements = [...sidebarContent.querySelectorAll("details")];
detailElements.forEach((element) => {
element.querySelectorAll("span").forEach((span) => {
if (span.classList.contains("large")) {
span.innerText = capitalizeEachWord(span.innerText);
}
});
});

// open ancestor details of the active item
const activeLink = sidebarContent.querySelector('a[aria-current="page"]');
if (activeLink) {
Expand Down

0 comments on commit 3b210ec

Please sign in to comment.