Files
garage/frontend/src/lib/components/ServiceTimeline.svelte
T
2026-08-06 19:00:08 +12:00

31 lines
1.1 KiB
Svelte

<script>
import ServiceEntryCard from './ServiceEntryCard.svelte'
// A real timeline — a dot per entry connected by a line, newest first
// (the API already returns entries newest-first). The dot/line column is
// a flex sibling of the content rather than absolutely positioned, so it
// naturally stretches to match each entry's height regardless of how much
// text/attachments it has.
let { entries, onEdit, onDelete, fileHref } = $props()
</script>
{#if entries.length === 0}
<p class="text-sm text-stone-400">No service history yet.</p>
{:else}
<ol>
{#each entries as entry, i (entry.id)}
<li class="flex gap-4">
<div class="flex w-3 shrink-0 flex-col items-center">
<span class="mt-1.5 h-3 w-3 shrink-0 rounded-full bg-teal-700 ring-4 ring-teal-100"></span>
{#if i < entries.length - 1}
<span class="w-px flex-1 bg-stone-200"></span>
{/if}
</div>
<div class="min-w-0 flex-1 pb-6">
<ServiceEntryCard {entry} {onEdit} {onDelete} {fileHref} />
</div>
</li>
{/each}
</ol>
{/if}