Fix behavior fo the sidebar

This commit is contained in:
Araozu 2024-05-01 07:20:34 -05:00
parent a449ea1085
commit 656f674843
4 changed files with 15 additions and 5 deletions

View File

@ -5,6 +5,9 @@ const entry: PageEntry = Astro.props.entry;
const basePath: string = Astro.props.basePath;
const entryPath = entry.path === "index"? "": entry.path;
const entryUrl = basePath + entryPath + (entryPath.endsWith("/")? "" : "/");
---
{
@ -12,7 +15,7 @@ const entryPath = entry.path === "index"? "": entry.path;
<li>
<a
class="inline-block rounded-2xl w-full hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors px-3 py-2"
href={`${basePath}${entryPath}`}
href={entryUrl}
>
{entry.title}
</a>

View File

@ -88,7 +88,9 @@ for (const entry of pagesIndex) {
</nav>
</div>
<main class="py-[3.5rem] lg:pl-12 lg:pr-4 markdown min-w-0 small-container mx-auto">
<main
class="py-[3.5rem] lg:pl-12 lg:pr-4 markdown min-w-0 small-container mx-auto"
>
<slot />
</main>
@ -133,7 +135,8 @@ for (const entry of pagesIndex) {
document.addEventListener("DOMContentLoaded", () => {
let current_uri = window.location.pathname;
const sidebar = document.getElementById("sidebar")!;
const sidebar = document.getElementById("sidebar")!.children[0]! as HTMLElement;
console.log(sidebar);
const links = sidebar.querySelectorAll("a");
for (const link of [...links]) {
if (link.getAttribute("href") === current_uri) {

View File

@ -21,7 +21,7 @@ function scan_decimal(input: string, starting_position: number): [string, number
let pos = starting_position;
while (pos < input.length) {
const c = input[pos];
const c = input[pos]!;
if (c === ".") {
// todo

View File

@ -144,6 +144,10 @@ fun sample(Int x)
0.0
}
catch Exception e
{ ... }
catch Error e
{ ... }
}
```