Deploy
This commit is contained in:
@@ -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 (
|
||||||
|
<div className="flex justify-center py-16">
|
||||||
|
<div className="w-8 h-8 rounded-full border-2 border-current border-t-transparent animate-spin text-[#C0392B]" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<section
|
||||||
|
id="kwantofontofogueststories"
|
||||||
|
data-vula-section="kwantofontofogueststories"
|
||||||
|
data-vula-cms="posts"
|
||||||
|
className="py-20 bg-[#FDF6EC]"
|
||||||
|
>
|
||||||
|
<div className="max-w-7xl mx-auto px-4 sm:px-6">
|
||||||
|
<h2 className="text-4xl font-bold text-[#2C1810] mb-12 text-center">
|
||||||
|
Guest Stories
|
||||||
|
</h2>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
|
{items.slice(0, 3).map((item) => {
|
||||||
|
const d = item.data as {
|
||||||
|
title?: string
|
||||||
|
excerpt?: string
|
||||||
|
body?: string
|
||||||
|
author?: string
|
||||||
|
image?: string
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className="rounded-xl overflow-hidden bg-white shadow-md border-2 border-[#E67E22]"
|
||||||
|
>
|
||||||
|
{d.image && (
|
||||||
|
<div className="relative h-48 w-full">
|
||||||
|
<Image
|
||||||
|
src={d.image}
|
||||||
|
alt={d.title || 'Guest story'}
|
||||||
|
fill
|
||||||
|
className="object-cover"
|
||||||
|
sizes="(max-width: 768px) 100vw, 33vw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="p-5">
|
||||||
|
<h3 className="text-lg font-semibold text-[#2C1810]">
|
||||||
|
{d.title}
|
||||||
|
</h3>
|
||||||
|
<p className="mt-2 text-sm text-gray-600 italic">
|
||||||
|
"{d.excerpt || d.body?.slice(0, 120) || ''}"
|
||||||
|
</p>
|
||||||
|
{d.author && (
|
||||||
|
<p className="mt-3 text-sm font-medium text-[#C0392B]">
|
||||||
|
— {d.author}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user