diff --git a/src/components/sections/SalonGallerySection.tsx b/src/components/sections/SalonGallerySection.tsx new file mode 100644 index 0000000..5787d1b --- /dev/null +++ b/src/components/sections/SalonGallerySection.tsx @@ -0,0 +1,90 @@ +'use client' + +import Image from 'next/image' +import { useMemo, useState } from 'react' +import { useVulaContent } from '@/hooks/useVulaContent' +import Badge from '@/components/ui/Badge' +import { Card, CardContent } from '@/components/ui/Card' + +interface GalleryData { + title?: string + description?: string + image?: string | null +} + +function getCategory(title = '') { + const t = title.toLowerCase() + if (t.includes('braid')) return 'Braids' + if (t.includes("colour") || t.includes("color") || t.includes("balayage") || t.includes("highlight")) return 'Colour' + if (t.includes("nail") || t.includes("mani") || t.includes('pedi')) return 'Nails' + if (t.includes("keratin") || t.includes("treatment")) return 'Treatments' + if (t.includes("cut") || t.includes("trim")) return 'Cuts' + return 'More' +} + +export default function SalonGallerySection() { + const { items, loading } = useVulaContent('gallery') + const [activeFilter, setActiveFilter] = useState('All') + + const categories = useMemo(() => { + const set = new Set(items.map((item) => getCategory((item.data as GalleryData).title))) + return ['All', ...Array.from(set)] + }, [items]) + + const filteredItems = useMemo(() => { + if (activeFilter === 'All') return items + return items.filter((item) => getCategory((item.data as GalleryData).title) === activeFilter) + }, [items, activeFilter]) + + if (loading) return ( +
From the Fourways studio floor
+A quick look at transformations our clients took home this season.
+{d.description}
} +