Fix behavior fo the sidebar
This commit is contained in:
parent
a449ea1085
commit
656f674843
@ -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>
|
||||
|
@ -76,7 +76,7 @@ for (const entry of pagesIndex) {
|
||||
<div class="lg:grid lg:grid-cols-[14rem_auto_12rem] lg:container mx-auto">
|
||||
<div
|
||||
id="sidebar"
|
||||
class="pt-12 h-screen lg:sticky top-0 fixed z-10 bg-c-bg w-60 lg:w-auto border-r-2 lg:border-0
|
||||
class="pt-12 h-screen lg:sticky top-0 fixed z-10 bg-c-bg w-60 lg:w-auto border-r-2 lg:border-0
|
||||
border-c-border-1 -translate-x-64 lg:translate-x-0 transition-transform"
|
||||
>
|
||||
<nav class="py-4 pr-2 overflow-x-scroll h-[calc(100vh-3rem)]">
|
||||
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -144,6 +144,10 @@ fun sample(Int x)
|
||||
|
||||
0.0
|
||||
}
|
||||
catch Exception e
|
||||
{ ... }
|
||||
catch Error e
|
||||
{ ... }
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user