import React from 'react'; import { AnimatePresence, motion } from 'framer-motion'; import { useStore } from '../src/context/StoreContext'; import { CollectionItem } from '../types'; import SEO, { SITE_URL } from '../components/SEO'; const Collections: React.FC = () => { const { products } = useStore(); const [selectedProduct, setSelectedProduct] = React.useState(null); React.useEffect(() => { if (!selectedProduct) { return undefined; } const handleEscape = (event: KeyboardEvent) => { if (event.key === 'Escape') { setSelectedProduct(null); } }; window.addEventListener('keydown', handleEscape); return () => window.removeEventListener('keydown', handleEscape); }, [selectedProduct]); const collectionsSchema = { "@context": "https://schema.org", "@type": "CollectionPage", "name": "Handcrafted Ceramic Collection | KNUTH Ceramics", "description": "Browse KNUTH Ceramics' handcrafted stoneware collection. Each piece is wheel-thrown in Corpus Christi, Texas, inspired by the Gulf Coast. Vases, bowls, tableware, and more from $45.", "url": `${SITE_URL}/collections`, "breadcrumb": { "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "Home", "item": `${SITE_URL}/` }, { "@type": "ListItem", "position": 2, "name": "Collections", "item": `${SITE_URL}/collections` } ] }, "numberOfItems": products.length, "itemListElement": products.map((p, i) => ({ "@type": "ListItem", "position": i + 1, "url": `${SITE_URL}/collections/${p.slug}`, "name": p.title })) }; return ( <>
{/* Header */}
Collection A gallery of handmade objects. Select any piece to view it larger, then close when you are done.
{/* Grid */}
{products.map((collection, index) => ( setSelectedProduct(collection)} className="group block cursor-pointer text-left" >
{collection.title}
))}
{selectedProduct && ( setSelectedProduct(null)} > event.stopPropagation()} > {selectedProduct.title} )} ); }; export default Collections;