aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/Toc.svelte
blob: 1d28ce614c2dd83785c41af47c8ef963029db72e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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>