From ea5c35ee856c6db989132f0fb594629fdda872f9 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Tue, 28 Oct 2025 14:55:45 +0100 Subject: [PATCH] fix: some minor layout improvements --- src/components/HeroCard.astro | 7 ++-- src/components/Image.astro | 8 +++-- src/components/card/Metadata.svelte | 32 ++++++++++--------- src/components/card/ReadMoreButton.svelte | 2 +- src/components/resources/Article.astro | 2 +- src/components/resources/Recipe.astro | 19 ++++++----- src/components/resources/Review.astro | 2 +- src/layouts/global.css | 23 +++++++++---- src/pages/about/index.astro | 5 --- .../[resourceType]/[resourceName].astro | 2 +- 10 files changed, 58 insertions(+), 44 deletions(-) delete mode 100644 src/pages/about/index.astro diff --git a/src/components/HeroCard.astro b/src/components/HeroCard.astro index 9d8bf76..8b4c6ec 100644 --- a/src/components/HeroCard.astro +++ b/src/components/HeroCard.astro @@ -25,10 +25,12 @@ const translatePath = useTranslatedPath(Astro.url); const t = useTranslations(Astro.url); const link = translatePath(`/${collection}/${id.split("/")[0]}`); + +const hasCover = typeof cover === "string" ? !!cover?.length : !!cover?.src; --- + classes={`grid gradient border-1 border-neutral overflow-hidden ${hasCover ? "grid-rows-[200px_1fr] xs:grid-rows-none xs:grid-cols-[1fr_200px]" : ""}`}> { (date || body || rating !== undefined) && ( @@ -57,11 +59,12 @@ const link = translatePath(`/${collection}/${id.split("/")[0]}`); { - cover && ( + hasCover && ( {"cover size.width)} @@ -92,5 +94,5 @@ const sizes = thumbnail .join(", ")}> - ) : undefined + ) :
{JSON.stringify({ image })}
} diff --git a/src/components/card/Metadata.svelte b/src/components/card/Metadata.svelte index d356bc8..28136de 100644 --- a/src/components/card/Metadata.svelte +++ b/src/components/card/Metadata.svelte @@ -34,21 +34,23 @@ }; -
- {#if rating} -
{formatRating(rating)}
- {/if} - {#if date} - - {/if} - {#if readDuration > 1} -
{readDuration} mins read
- {/if} - {#if author} -
{author}
- {/if} -
+{#if rating || date || readDuration || author} +
+ {#if rating} +
{formatRating(rating)}
+ {/if} + {#if date} + + {/if} + {#if readDuration > 1} +
{readDuration} mins read
+ {/if} + {#if author} +
{author}
+ {/if} +
+{/if}