fix: some image loading
Some checks failed
Deploy to SFTP Server / build (push) Failing after 1m55s

This commit is contained in:
Max Richter
2025-10-24 13:43:34 +02:00
parent 231bdb09a3
commit 6230126d38
11 changed files with 120 additions and 92 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
export let date: string | Date;
export let readDuration: string | undefined;
export let readDuration: number | undefined;
export let rating: string | number | undefined;
const toDate = (d: string | Date) =>
typeof d === "string" ? new Date(d) : d;
@@ -10,6 +11,13 @@
return isNaN(v.getTime()) ? "" : v.toISOString();
};
function formatRating(rating: string | number) {
if (typeof rating === "number") {
return "⭐".repeat(rating);
}
return rating;
}
const formatDate = (d: string | Date) => {
try {
return new Intl.DateTimeFormat("de-DE", {
@@ -29,7 +37,13 @@
>{formatDate(date)}</time>
{/if}
{#if readDuration}
<div class="text-sm text-neutral">{readDuration} mins read</div>
{#if typeof readDuration === "number"}
{#if readDuration > 1}
<div class="text-sm text-neutral">{readDuration} mins read</div>
{/if}
{/if}
{#if rating}
<div class="text-sm text-neutral">{formatRating(rating)}</div>
{/if}
</div>