Skip to content

Commit 4e31683

Browse files
committed
Add scroll target styles to sidebar nav
1 parent 6e9c475 commit 4e31683

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

docs/src/assets/main.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,19 @@
9494
margin: 0 -0.1875rem;
9595
background-color: color-mix(in srgb, currentColor, transparent 70%);
9696
}
97+
98+
.sidebar-nav {
99+
scroll-target-group: auto;
100+
101+
a:target-current {
102+
font-weight: 600;
103+
color: theme("colors.gray.900");
104+
border-color: theme("colors.gray.900");
105+
106+
@media (prefers-color-scheme: dark) {
107+
color: theme("colors.white");
108+
border-color: theme("colors.white");
109+
}
110+
}
111+
}
97112
}

docs/src/layouts/page.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ layout: base
2424
<div
2525
className="sticky top-14 max-h-[calc(100svh-3.5rem)] overflow-x-hidden px-6 pt-10 pb-24"
2626
>
27-
<div class="flex flex-col gap-3">
27+
<nav class="sidebar-nav flex flex-col gap-3">
2828
<h5
2929
class="font-mono text-sm/6 font-medium tracking-widest text-gray-500 uppercase sm:text-xs/6 dark:text-gray-400"
3030
>
3131
On this page
3232
</h5>
3333
{{ content | toc | safe }}
34-
</div>
34+
</nav>
3535
</div>
3636
</div>
3737
</div>

0 commit comments

Comments
 (0)