kios-webapp/astro/src/pages/index.astro

27 lines
697 B
Plaintext
Raw Normal View History

---
import Layout from "../layouts/Layout.astro";
import { getPosts } from "../utils/payload";
const posts = await getPosts();
---
<Layout title="Welcome to Astroad">
<main class="flex flex-col items-center py-10 gap-5">
<h1>This is Astroad</h1>
{
posts ? (
posts.reverse().map((post) => (
<a href={`/posts/${post.id}`}>
<article class="text-teal-950 bg-yellow-100 px-5 py-3 rounded-md shadow-md w-64 text-center">
<h2>{post.title}</h2>
<p>{new Date(post.updatedAt).toLocaleDateString("de-DE")}</p>
</article>
</a>
))
) : (
<p>No posts...</p>
)
}
</main>
</Layout>