diff --git a/src/routes/index.tsx b/src/routes/index.tsx index af32748..b39e731 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -1,7 +1,18 @@ import { createFileRoute } from "@tanstack/react-router"; +import { findPosts } from "@/lib/cms"; import Landing from "@/sections/Landing"; +import LatestPosts from "@/sections/LatestPosts"; export const Route = createFileRoute("/")({ + loader: async () => { + // Soft-fail on CMS hiccups so the hero still renders. + try { + const { docs } = await findPosts("de", 2); + return { posts: docs }; + } catch { + return { posts: [] }; + } + }, component: HomePage, head: () => ({ meta: [{ title: "unom - Kreative Webentwicklung" }], @@ -9,5 +20,11 @@ export const Route = createFileRoute("/")({ }); function HomePage() { - return ; + const { posts } = Route.useLoaderData(); + return ( + <> + + + + ); } diff --git a/src/sections/Landing.tsx b/src/sections/Landing.tsx index 63b9c04..3f4ec16 100644 --- a/src/sections/Landing.tsx +++ b/src/sections/Landing.tsx @@ -3,19 +3,22 @@ import bgDark from "@/assets/unom_Logo_5_Dark.webp"; export default function Landing() { return ( -
-
-
- -
-
+
Ein 3D Rendering des unom Logos +
+
+ +
+

+ Kreative Webentwicklung aus Rottweil. +

+
); } diff --git a/src/sections/LatestPosts.tsx b/src/sections/LatestPosts.tsx new file mode 100644 index 0000000..5d829ae --- /dev/null +++ b/src/sections/LatestPosts.tsx @@ -0,0 +1,24 @@ +import PostCard from "@/components/PostCard"; +import Section from "@/components/Section"; +import type { Post } from "@/lib/cms"; +import { Link } from "@tanstack/react-router"; + +export default function LatestPosts({ posts }: { posts: Post[] }) { + if (posts.length === 0) return null; + + return ( +
+
+

Aus dem Blog

+ + Alle Beiträge → + +
+
+ {posts.map((post) => ( + + ))} +
+
+ ); +}