aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/Toc.svelte
diff options
context:
space:
mode:
authorLibravatar limina1 <ifrit@pop-os.localdomain>2024-01-24 20:35:07 -0500
committerLibravatar limina1 <ifrit@pop-os.localdomain>2024-01-24 20:35:07 -0500
commit2a6cbb5a1636735690493bcc8dcac147a174de45 (patch)
treebb6a70425b359fbc4dcd50f5c52983520ba3cf0c /src/lib/components/Toc.svelte
initial commit
Diffstat (limited to 'src/lib/components/Toc.svelte')
-rw-r--r--src/lib/components/Toc.svelte21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/components/Toc.svelte b/src/lib/components/Toc.svelte
new file mode 100644
index 0000000..1d28ce6
--- /dev/null
+++ b/src/lib/components/Toc.svelte
@@ -0,0 +1,21 @@
+<script lang="ts">
+ import type { NDKEvent } from '@nostr-dev-kit/ndk';
+ import {nip19} from 'nostr-tools';
+ export let notes: NDKEvent[] = [];
+ console.log(notes);
+</script>
+
+<div class="toc">
+ <h2>Table of contents</h2>
+ <ul>
+ {#each notes as note}
+ <li><a href="#{nip19.noteEncode(note.id)}">{note.getMatchingTags('title')[0][1]}</a></li>
+ {/each}
+ </ul>
+</div>
+
+<style>
+ .toc h2 {
+ text-align: center;
+ }
+</style>