feat: add RoastGallery component with JSON config

- Create RoastGallery component that loads photos from roasts.json
- Responsive grid layout (2/3/4 columns based on screen size)
- Vietnamese section title "Bộ Sưu Tập Huyền Thoại"
This commit is contained in:
2026-03-11 14:42:52 +01:00
parent fe729e40a0
commit 8d57f76a86
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { useState, useEffect } from 'react'
import RoastCard from './RoastCard'
export default function RoastGallery() {
const [roasts, setRoasts] = useState([])
useEffect(() => {
fetch('/roasts.json')
.then((res) => res.json())
.then((data) => setRoasts(data))
.catch((err) => console.error('Failed to load roasts:', err))
}, [])
return (
<section className="max-w-7xl mx-auto px-4 py-12">
<h2 className="text-3xl font-bold text-center mb-8 text-gray-800">
📸 Bộ Sưu Tập "Huyền Thoại"
</h2>
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6">
{roasts.map((roast, index) => (
<RoastCard
key={index}
image={roast.image}
caption={roast.caption}
/>
))}
</div>
</section>
)
}