feat: Add comment trees

This commit is contained in:
Xyphyn committed 2023-06-30 19:44:30 -07:00
1 parent 83608fdaa6
commit 09d86dd721
13 files changed
+325 -91

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
<script lang="ts">
import Comment from './Comment.svelte'
import type { CommentNodeI } from './comments.js'
const maxComments = 10
export let nodes: CommentNodeI[]
export let isParent: boolean
</script>
<ul
class={isParent
? ''
: 'ml-2 mx-2.5 px-2.5 border-l-2 border-black/10 dark:border-white/10'}
>
{#each nodes.slice(0, maxComments) as node}
<Comment {node} />
{#if node.children?.length > 0}
<svelte:self nodes={node.children} isParent={false} />
{/if}
{/each}
</ul>