File tree 2 files changed +20
-4
lines changed
2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change
1
+ <script lang =" ts" context =" module" >
2
+ export type TocItem = {
3
+ title: string ;
4
+ href: string ;
5
+ step? : number ;
6
+ selected? : boolean ;
7
+ level? : number ;
8
+ children? : Array <{
9
+ title: string ;
10
+ href: string ;
11
+ selected: boolean ;
12
+ level? : number ;
13
+ }>;
14
+ };
15
+ </script >
16
+
1
17
<script lang =" ts" >
2
- import type { TocItem } from ' $lib/layouts/DocsArticle.svelte' ;
3
18
import { classNames } from ' $lib/utils/classnames' ;
4
19
import { fade } from ' svelte/transition' ;
5
20
9
24
10
25
let isScrolled: boolean = false ;
11
26
12
- window . addEventListener ( ' scroll ' , () => {
27
+ const handleIsScrolled = () => {
13
28
isScrolled = !! window .scrollY ;
14
- }) ;
29
+ };
15
30
16
31
export let toc: Array <TocItem > = [];
17
32
export let heading: string = ' Table of Contents' ;
18
33
</script >
19
34
35
+ <svelte:window on:scroll ={handleIsScrolled } />
36
+
20
37
<nav class =" sticky top-32 col-span-3 mt-2 -ml-4 hidden h-[800px] flex-col gap-6 lg:flex" >
21
38
<span class =" text-micro tracking-loose text-primary font-aeonik-fono ps-6 uppercase"
22
39
>{heading }</span
Original file line number Diff line number Diff line change 18
18
import { setContext } from ' svelte' ;
19
19
import { writable } from ' svelte/store' ;
20
20
import { Feedback } from ' $lib/components' ;
21
- import { scrollToTop } from ' $lib/actions/scrollToTop' ;
22
21
import TableOfContents from ' $lib/components/blog/table-of-contents.svelte' ;
23
22
24
23
export let title: string ;
You can’t perform that action at this time.
0 commit comments