Add Latest Posts support

This commit is contained in:
prototypa
2022-11-06 15:47:44 -05:00
parent 8c646d7f72
commit 2d0687d885
8 changed files with 102 additions and 52 deletions

View File

@@ -9,18 +9,18 @@ const { post } = Astro.props;
<section class="py-8 sm:py-16 lg:py-20 mx-auto">
<article>
<header>
<p class="max-w-3xl mx-auto text-center">
<header class={post.image ? 'text-center' : ''}>
<p class="px-4 sm:px-6 max-w-3xl mx-auto">
<time datetime={post.publishDate}>{getFormattedDate(post.publishDate)}</time> ~ {Math.ceil(post.readingTime)} min
read
</p>
<h1
class="px-4 sm:px-6 max-w-3xl mx-auto text-center text-4xl md:text-5xl font-bold leading-tighter tracking-tighter mb-8 font-heading"
class="px-4 sm:px-6 max-w-3xl mx-auto text-4xl md:text-5xl font-bold leading-tighter tracking-tighter mb-8 font-heading"
>
{post.title}
</h1>
{
post.image && (
post.image ? (
<Picture
src={post.image}
class="max-w-full lg:max-w-6xl mx-auto mt-4 mb-6 sm:rounded-md bg-gray-400 dark:bg-slate-700"
@@ -29,6 +29,10 @@ const { post } = Astro.props;
alt={post.description}
aspectRatio="16:9"
/>
) : (
<div class="max-w-3xl mx-auto px-4 sm:px-6">
<div class="border-t dark:border-slate-700" />
</div>
)
}
</header>