2024-02-18 00:55:43 +04:00
|
|
|
---
|
2024-02-18 07:39:17 +04:00
|
|
|
// Import necessary modules and utilities
|
2024-02-18 00:55:43 +04:00
|
|
|
import { Image } from "astro:assets";
|
|
|
|
import { formatDate } from "../../../utils";
|
|
|
|
import type { CollectionEntry } from "astro:content";
|
2024-02-18 07:39:17 +04:00
|
|
|
// Define data source from Astro.js incoming props
|
2024-02-18 00:55:43 +04:00
|
|
|
const { blogEntry } = Astro.props;
|
2024-02-18 07:39:17 +04:00
|
|
|
// Define TypeScript props interface
|
2024-02-18 00:55:43 +04:00
|
|
|
interface Props {
|
|
|
|
blogEntry: CollectionEntry<"blog">;
|
|
|
|
}
|
|
|
|
---
|
|
|
|
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The anchor tag is the main container for the blog preview card. Currently, it links to "#".
|
|
|
|
You might want to change it to the corresponding blog post's URL. -->
|
2024-02-18 00:55:43 +04:00
|
|
|
<a
|
|
|
|
class="group block rounded-xl outline-none ring-zinc-500 transition duration-300 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none"
|
|
|
|
href="#"
|
|
|
|
>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The blog post's cover image. It uses astro:assets' Image for loading the image optimally -->
|
2024-02-18 00:55:43 +04:00
|
|
|
<div>
|
|
|
|
<Image
|
|
|
|
class="aspect-video rounded-xl"
|
|
|
|
src={blogEntry.data.cardImage}
|
|
|
|
alt={blogEntry.data.cardImageAlt}
|
|
|
|
draggable={"false"}
|
|
|
|
format={"avif"}
|
|
|
|
/>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The title of the blog post -->
|
2024-02-18 00:55:43 +04:00
|
|
|
<h3
|
|
|
|
class="mt-2 text-balance text-lg font-medium text-neutral-800 group-hover:text-[#fa5a15] dark:text-neutral-300 dark:group-hover:text-neutral-50"
|
|
|
|
>
|
|
|
|
{blogEntry.data.title}
|
|
|
|
</h3>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The formatted publication date of the blog post -->
|
2024-02-18 00:55:43 +04:00
|
|
|
<p class="mt-2 text-sm text-neutral-600 dark:text-neutral-400">
|
|
|
|
{formatDate(blogEntry.data.pubDate)}
|
|
|
|
</p>
|
|
|
|
</div></a
|
|
|
|
>
|