diff --git a/src/components/sections/KwaNtofontofoGuestStoriesSection.tsx b/src/components/sections/KwaNtofontofoGuestStoriesSection.tsx new file mode 100644 index 0000000..5d67068 --- /dev/null +++ b/src/components/sections/KwaNtofontofoGuestStoriesSection.tsx @@ -0,0 +1,80 @@ +'use client' + +import { useEmDashContent } from '@/hooks/useEmDashContent' +import Image from 'next/image' + +export default function KwaNtofontofoGuestStoriesSection() { + const { items, loading } = useEmDashContent('posts') + + if (loading) { + return ( +
+
+
+ ) + } + + if (items.length === 0) return null + + // Filter posts tagged 'guest-stories' if category indicates that, or use all posts with title + const stories = items.filter( + (item) => (item.data as any)?.category === 'guest-stories' || true + ) + + return ( +
+
+

+ Guest Stories +

+
+ {items.slice(0, 3).map((item) => { + const d = item.data as { + title?: string + excerpt?: string + body?: string + author?: string + image?: string + } + return ( +
+ {d.image && ( +
+ {d.title +
+ )} +
+

+ {d.title} +

+

+ "{d.excerpt || d.body?.slice(0, 120) || ''}" +

+ {d.author && ( +

+ — {d.author} +

+ )} +
+
+ ) + })} +
+
+
+ ) +}