blog/frontend/src/lib/post/framework/ui/PostPreviewLabels.svelte
SquidSpirit e177814996
Some checks failed
Frontend CI / build (push) Successful in 1m39s
Auto Comment On PR / add_improve_comment (pull_request) Successful in 17s
PR Title Check / pr-title-check (pull_request) Failing after 16s
refactor: move label to a new feature
2025-10-15 05:31:00 +08:00

18 lines
514 B
Svelte

<script lang="ts">
import type { LabelViewModel } from '$lib/label/adapter/presenter/labelViewModel';
import PostLabel from '$lib/label/framework/ui/PostLabel.svelte';
const { labels }: { labels: readonly LabelViewModel[] } = $props();
</script>
<div class="flex flex-row gap-x-2">
{#each labels.slice(0, 2) as label (label.id)}
<PostLabel {label} />
{/each}
{#if labels.length > 2}
<div class="rounded-full bg-gray-200 px-2 py-0.5 text-xs">
<span>+{labels.length - 2}</span>
</div>
{/if}
</div>