Fix behavior fo the sidebar

master
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 basePath: string = Astro.props.basePath;
const entryPath = entry.path === "index"? "": entry.path; 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> <li>
<a <a
class="inline-block rounded-2xl w-full hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors px-3 py-2" 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} {entry.title}
</a> </a>

View File

@ -88,7 +88,9 @@ for (const entry of pagesIndex) {
</nav> </nav>
</div> </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 /> <slot />
</main> </main>
@ -133,7 +135,8 @@ for (const entry of pagesIndex) {
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
let current_uri = window.location.pathname; 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"); const links = sidebar.querySelectorAll("a");
for (const link of [...links]) { for (const link of [...links]) {
if (link.getAttribute("href") === current_uri) { 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; let pos = starting_position;
while (pos < input.length) { while (pos < input.length) {
const c = input[pos]; const c = input[pos]!;
if (c === ".") { if (c === ".") {
// todo // todo

View File

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