Files
kochwas/src/lib/components/TimeDisplay.svelte
hsiegeln 504fbb6cc6
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m21s
refactor(view): TimeDisplay als eigenstaendige Component
timeSummary-Formatierung in eine wiederverwendbare Component
gezogen. RecipeView liefert nur noch die drei Werte — zukuenftige
Call-Sites (Preview, Hover-Cards) koennen dieselbe Logik reusen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 13:50:46 +02:00

31 lines
702 B
Svelte

<script lang="ts">
type Props = {
prepTimeMin: number | null;
cookTimeMin: number | null;
totalTimeMin: number | null;
};
let { prepTimeMin, cookTimeMin, totalTimeMin }: Props = $props();
const summary = $derived.by(() => {
const parts: string[] = [];
if (prepTimeMin) parts.push(`Vorb. ${prepTimeMin} min`);
if (cookTimeMin) parts.push(`Kochen ${cookTimeMin} min`);
if (!prepTimeMin && !cookTimeMin && totalTimeMin)
parts.push(`Gesamt ${totalTimeMin} min`);
return parts.join(' · ');
});
</script>
{#if summary}
<p class="times">{summary}</p>
{/if}
<style>
.times {
margin: 0 0 0.25rem;
color: #666;
font-size: 0.9rem;
}
</style>