feat: Make comments fully collapse
This commit is contained in:
1 parent
801278a1e1
commit
895a571e4f
3 files changed
+21
-7
No files matched your search
@@ -92,6 +92,13 @@
|
||||
<span class="opacity-50">{postData.creator.name}</span>
|
||||
</span>
|
||||
<h1 class="font-bold text-lg">{post.name}</h1>
|
||||
<a
|
||||
href={post.url}
|
||||
class="text-sky-400 max-w-[48ch] overflow-hidden
|
||||
whitespace-nowrap text-ellipsis text-xs hover:underline"
|
||||
>
|
||||
{post.url}
|
||||
</a>
|
||||
{#if post.thumbnail_url}
|
||||
<img
|
||||
src={post.thumbnail_url}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { ArrowDown, ArrowUp, Icon } from 'svelte-hero-icons'
|
||||
import { ArrowDown, ArrowUp, Icon, Minus, Plus } from 'svelte-hero-icons'
|
||||
import Avatar from './Avatar.svelte'
|
||||
import type { CommentNodeI } from './comments.js'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
import RelativeDate from '$lib/components/RelativeDate.svelte'
|
||||
import Button from '$lib/components/Button.svelte'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
|
||||
export let node: CommentNodeI
|
||||
export let open = true
|
||||
</script>
|
||||
|
||||
<li class="py-3">
|
||||
<details {open} class="flex flex-col gap-1">
|
||||
<details bind:open class="flex flex-col gap-1">
|
||||
<summary class="flex flex-row cursor-pointer arrow gap-2 items-center">
|
||||
<!-- <button class="-z-10">
|
||||
<Icon src={open ? Minus : Plus} width={12} mini />
|
||||
</button> -->
|
||||
<Avatar
|
||||
url={node.comment_view.creator.avatar ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${node.comment_view.creator.name}`}
|
||||
@@ -47,5 +52,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<slot />
|
||||
</details>
|
||||
</li>
|
||||
@@ -11,12 +11,13 @@
|
||||
<ul
|
||||
class={isParent
|
||||
? ''
|
||||
: 'ml-2 mx-2.5 px-2.5 border-l-2 border-black/10 dark:border-white/10'}
|
||||
: 'ml-2 mt-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} open={true} />
|
||||
{#if node.children?.length > 0}
|
||||
<svelte:self nodes={node.children} isParent={false} />
|
||||
{/if}
|
||||
<Comment {node} open={true}>
|
||||
{#if node.children?.length > 0}
|
||||
<svelte:self nodes={node.children} isParent={false} />
|
||||
{/if}
|
||||
</Comment>
|
||||
{/each}
|
||||
</ul>
|
||||
Reference in new issue
Block a user