Deploy
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
'use client'
|
||||
import { useState } from 'react';
|
||||
import { useVulaContent } from '@/hooks/useVulaContent'
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/Card'
|
||||
import Badge from '@/components/ui/Badge'
|
||||
import Image from 'next/image'
|
||||
|
||||
export default function BotanicalWisdomSection() {
|
||||
const { items, loading } = useVulaContent('posts')
|
||||
const [openIndex, setOpenIndex] = useState(-1) // hook before guard
|
||||
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" /></div>
|
||||
if (items.length === 0) return null
|
||||
const posts = items.slice(0, 3)
|
||||
return (
|
||||
<section id="botanical-wisdom" data-vula-section="botanicalwisdom" data-vula-cms="posts" className="bg-[#f4f5f2] py-20 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<div className="text-center mb-12">
|
||||
<p className="text-sm text-[#8b5a3c] font-medium mb-2">From our journal</p>
|
||||
<h2 className="text-3xl font-semibold text-[#2c331f]">Botanical <span className="text-[#6b8e23]">Wisdom</span></h2>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
{posts.map((item) => {
|
||||
const d = item.data as { title?: string; excerpt?: string; author?: string; category?: string; image?: string }
|
||||
return (
|
||||
<Card key={item.id} className="rounded-[28px] overflow-hidden shadow-lg hover:shadow-xl transition-shadow border-0 bg-white">
|
||||
{d.image && (
|
||||
<div className="relative h-48 w-full">
|
||||
<Image src={d.image} alt={d.title ?? ''} fill className="object-cover" sizes="(max-width: 768px) 100vw, 33vw" />
|
||||
</div>
|
||||
)}
|
||||
<CardHeader className="pb-2">
|
||||
{d.category && <Badge variant="accent" className="bg-[#6b8e23] text-white text-xs px-3 py-1 rounded-full self-start mb-2">{d.category}</Badge>}
|
||||
{d.title && <CardTitle className="text-lg text-[#2c331f]">{d.title}</CardTitle>}
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0">
|
||||
{d.excerpt && <p className="text-sm text-[#2c331f]/70 line-clamp-3">{d.excerpt}</p>}
|
||||
{d.author && <p className="text-xs text-[#8b5a3c] mt-3 font-medium">By {d.author}</p>}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user