flotilla/src/app/components/NoteItem.svelte

39 lines
1.1 KiB
Svelte
Raw Normal View History

2024-10-31 19:24:40 +00:00
<script lang="ts">
2026-02-03 17:49:44 +00:00
import type {Snippet} from "svelte"
import type {TrustedEvent} from "@welshman/util"
2025-02-11 23:37:50 +00:00
import NoteContent from "@app/components/NoteContent.svelte"
2024-10-31 19:24:40 +00:00
import NoteCard from "@app/components/NoteCard.svelte"
import EventReactions from "@app/components/EventReactions.svelte"
import Cv from "@lib/components/Cv.svelte"
import type {FeedContext} from "@app/feeds"
2024-10-31 19:24:40 +00:00
2026-02-03 17:49:44 +00:00
type Props = {
event: TrustedEvent
children?: Snippet
context: FeedContext
url?: string
card?: boolean
showEntire?: boolean
2026-02-03 17:49:44 +00:00
}
const {url, event, children, context, card = true, showEntire = false}: Props = $props()
2024-10-31 19:24:40 +00:00
</script>
{#snippet body()}
<NoteContent {event} {showEntire} expandMode="inline" />
2024-10-31 19:24:40 +00:00
<div class="flex w-full justify-between gap-2">
<EventReactions {event} {context} {url} reactionClass="tip-right" />
2026-02-03 17:49:44 +00:00
{@render children?.()}
2024-10-31 19:24:40 +00:00
</div>
{/snippet}
{#if card}
<Cv tag={NoteCard} {event} {url} interactive class="card card-interactive">
{@render body()}
</Cv>
{:else}
<NoteCard {event} {url}>
{@render body()}
</NoteCard>
{/if}