Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768<script lang="ts"> import MessageSquarePlus from "$icon/message-square-plus"; import Reply from "$icon/reply"; import { type MarkupContext } from "$lib/markup"; import Card from "$lib/components/ui/Card.svelte"; import CommentEditor from "$lib/components/comment/CommentEditor.svelte"; import type { ThreadInput } from "$lib/components/comment/comments";
interface Props { subjectUri: string; subjectCid?: string; replyToUri?: string; replyToCid?: string; authorDid: string; authorHandle: string; markup: MarkupContext; // "thread" tucks the box into a comment card, matching its canvas background variant?: "default" | "thread"; onsubmitted?: (submitted: ThreadInput) => void; }
let { subjectUri, subjectCid, replyToUri, replyToCid, authorDid, authorHandle, markup, variant = "default", onsubmitted }: Props = $props();
const isThread = $derived(variant === "thread");</script>
{#snippet editor()} <CommentEditor {subjectUri} {subjectCid} {replyToUri} {replyToCid} {authorDid} {authorHandle} {markup} placeholder={isThread ? "Leave a reply..." : "Add to the discussion. Markdown is supported."} submitLabel={isThread ? "Reply" : "Comment"} submitIcon={isThread ? Reply : MessageSquarePlus} compact={isThread} inset={!isThread} {onsubmitted} />{/snippet}
{#if isThread} <div class="rounded-b-sm bg-background-default/50 py-2xs pr-2xs pl-xl transition-shadow focus-within:ring-2 focus-within:ring-border-strong" > {@render editor()} </div>{:else} <Card padding="none" class="overflow-visible"> {@render editor()} </Card>{/if}