diff options
Diffstat (limited to 'src/lib/Toc.svelte')
-rw-r--r-- | src/lib/Toc.svelte | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/Toc.svelte b/src/lib/Toc.svelte new file mode 100644 index 0000000..190c6a4 --- /dev/null +++ b/src/lib/Toc.svelte @@ -0,0 +1,27 @@ +<script lang="ts"> + import { cleanId } from './utils' + + export let categories: string[] +</script> + +<ul id="toc"> + <h3>Contents</h3> + {#each categories as category} + <li><a href="#{category}">{cleanId(category)}</a></li> + {/each} +</ul> + +<style> + #toc { + border: 1px solid rgba(255, 255, 255, 0.1); + max-width: max-content; + padding: 0.75em; + border-radius: 1em; + + display: inline-block; + background: rgba(0, 0, 0, 0.1); + } + #toc li { + list-style-type: none; + } +</style> |