summaryrefslogtreecommitdiff
path: root/src/lib/components/PostCard.svelte
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-01-29 23:56:21 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-01-29 23:56:21 +0300
commit35556dca71eafdac4eb5d2fe781ba39687d0b058 (patch)
treed85489336dce549b08d385c45cec6ae0678b211b /src/lib/components/PostCard.svelte
parent292d9dd4241ace94bfaf50827dcedfbd40de8032 (diff)
initial commit
Diffstat (limited to 'src/lib/components/PostCard.svelte')
-rw-r--r--src/lib/components/PostCard.svelte27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/components/PostCard.svelte b/src/lib/components/PostCard.svelte
new file mode 100644
index 0000000..7fb9361
--- /dev/null
+++ b/src/lib/components/PostCard.svelte
@@ -0,0 +1,27 @@
+<script lang="ts">
+ import type { Post } from "$lib/utils/posts";
+
+ interface Props {
+ post: Post;
+ }
+
+ let { post }: Props = $props();
+
+ function formatDate(dateStr: string): string {
+ return new Date(dateStr).toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ });
+ }
+</script>
+
+<article>
+ <header>
+ <a href="/posts/{post.slug}">
+ <h1 style="text-decoration: none;">{post.title}</h1>
+ </a>
+ <small><time datetime={post.date}>{formatDate(post.date)}</time></small>
+ </header>
+ <p>{post.description}</p>
+</article>