Deploy
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState } from "react"
|
||||||
|
import { useEmDashContent } from "@/hooks/useEmDashContent"
|
||||||
|
import { ChevronDown, ChevronUp } from 'lucide-react'
|
||||||
|
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/Card"
|
||||||
|
|
||||||
|
export default function StorePoliciesSection() {
|
||||||
|
const { items, loading } = useEmDashContent("policies")
|
||||||
|
const [openIndex, setOpenIndex] = useState<number | null>(null)
|
||||||
|
|
||||||
|
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 toggle = (index: number) => {
|
||||||
|
setOpenIndex(openIndex === index ? null : index)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
id="store-policies"
|
||||||
|
data-vula-section="storepolicies"
|
||||||
|
data-vula-cms="policies"
|
||||||
|
className="py-20 bg-neutral-50"
|
||||||
|
>
|
||||||
|
<div className="max-w-3xl mx-auto px-4">
|
||||||
|
<h2 className="text-3xl font-bold text-[#18181b] text-center mb-10">Store Policies</h2>
|
||||||
|
<div className="space-y-4">
|
||||||
|
{items.map((item, index) => {
|
||||||
|
const d = item.data as { title?: string; body?: string }
|
||||||
|
const isOpen = openIndex === index
|
||||||
|
return (
|
||||||
|
<Card key={item.id} className="border border-gray-200 shadow-sm">
|
||||||
|
<CardHeader
|
||||||
|
className="cursor-pointer flex justify-between items-center p-4"
|
||||||
|
onClick={() => toggle(index)}
|
||||||
|
>
|
||||||
|
<CardTitle className="text-lg font-semibold text-[#18181b]">{d.title || "Policy"}</CardTitle>
|
||||||
|
{isOpen ? (
|
||||||
|
<ChevronUp className="w-5 h-5 text-gray-500" />
|
||||||
|
) : (
|
||||||
|
<ChevronDown className="w-5 h-5 text-gray-500" />
|
||||||
|
)}
|
||||||
|
</CardHeader>
|
||||||
|
{isOpen && (
|
||||||
|
<CardContent className="px-4 pb-4 text-gray-700">
|
||||||
|
<p>{d.body || "Details coming soon."}</p>
|
||||||
|
</CardContent>
|
||||||
|
)}
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user