Skip to content

Commit ede44b2

Browse files
committed
docs: Improve display of table of contents
1 parent c488940 commit ede44b2

3 files changed

Lines changed: 33 additions & 10 deletions

File tree

packages/layerchart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"svelte": "5.34.1",
7070
"svelte-check": "^4.2.1",
7171
"svelte-json-tree": "^2.2.0",
72-
"svelte-ux": "2.0.0-next.11",
72+
"svelte-ux": "2.0.0-next.13",
7373
"svelte2tsx": "^0.7.39",
7474
"tailwindcss": "^4.1.10",
7575
"topojson-client": "^3.1.0",

packages/layerchart/src/routes/docs/+layout.svelte

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
mdiGithub,
1515
mdiLink,
1616
} from '@mdi/js';
17+
// @ts-expect-error
18+
import IconAlignLeft from '~icons/lucide/align-left';
1719
1820
import {
1921
ApiDocs,
@@ -225,8 +227,16 @@
225227
on:click={() => (showTableOfContents = false)}
226228
/>
227229
<TableOfContents
228-
icon={mdiChevronRight}
229-
class="px-4 py-2"
230+
linkIndent={12}
231+
class="p-4"
232+
classes={{
233+
a: cls(
234+
'border-l text-sm text-surface-content/50 py-[2px] hover:text-surface-content',
235+
'data-active:border-primary data-active:text-primary',
236+
'data-[level=1]:font-semibold'
237+
),
238+
}}
239+
scrollOffset={184}
230240
on:nodeClick={(e) => {
231241
showTableOfContents = false;
232242
}}
@@ -316,12 +326,25 @@
316326
<div
317327
class="w-[224px] sticky top-[calc(var(--headerHeight)+10px)] pr-2 max-h-[calc(100dvh-64px)] overflow-auto z-60"
318328
>
319-
<div class="text-xs uppercase leading-8 tracking-widest text-surface-content/50">
329+
<div
330+
class="flex gap-2 items-center text-xs font-medium uppercase pb-3 tracking-widest text-surface-content/50"
331+
>
332+
<IconAlignLeft />
320333
On this page
321334
</div>
322335
<!-- Rebuild toc when page changes -->
323336
{#key page.route.id}
324-
<TableOfContents icon={mdiChevronRight} class="border-l pl-3" scrollOffset={184} />
337+
<TableOfContents
338+
linkIndent={12}
339+
classes={{
340+
a: cls(
341+
'border-l text-sm text-surface-content/50 py-[2px] hover:text-surface-content',
342+
'data-active:border-primary data-active:text-primary',
343+
'data-[level=1]:font-semibold'
344+
),
345+
}}
346+
scrollOffset={184}
347+
/>
325348
{/key}
326349
</div>
327350
{/if}

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)