summaryrefslogtreecommitdiff
path: root/src/components/BlogCard.astro
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-24 12:08:41 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-24 12:50:43 -0300
commitf9a77c5c27aede4e5978eb55d9b7af781b680a1d (patch)
treed545e325ba1ae756fc2eac66fac1001b6753c40d /src/components/BlogCard.astro
feat!: initial commit
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/BlogCard.astro')
-rw-r--r--src/components/BlogCard.astro38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/BlogCard.astro b/src/components/BlogCard.astro
new file mode 100644
index 0000000..7ab42d7
--- /dev/null
+++ b/src/components/BlogCard.astro
@@ -0,0 +1,38 @@
+---
+import type { CollectionEntry } from "astro:content";
+
+interface Props extends CollectionEntry<"blog"> {}
+
+const { id, data } = Astro.props;
+const { title, description, dateCreated, lang } = data;
+
+const href = `/blog/read/${id}`;
+---
+
+<article>
+ <h2>
+ <a {href}>{title}</a>
+ </h2>
+ <p>{description}</p>
+ <footer>
+ <span><time datetime={(dateCreated as Date).toISOString()}>{
+ new Intl.DateTimeFormat(lang, {
+ weekday: "long",
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ hour: "2-digit",
+ minute: "2-digit",
+ timeZoneName: "long",
+ }).format(dateCreated)
+ }</time></span>
+ </footer>
+</article>
+
+<style>
+ article {
+ border-block-end: 1px solid #181818;
+ padding-block-end: 1rem;
+ margin-block: 0.5rem;
+ }
+</style>