diff --git a/src/components/sections/product/ProductMediaCards.tsx b/src/components/sections/product/ProductMediaCards.tsx index 7ae3a37..173363e 100644 --- a/src/components/sections/product/ProductMediaCards.tsx +++ b/src/components/sections/product/ProductMediaCards.tsx @@ -1,10 +1,15 @@ -import { ArrowUpRight, Loader2 } from "lucide-react"; import { motion } from "motion/react"; import Button from "@/components/ui/Button"; import TextAnimation from "@/components/ui/TextAnimation"; -import ImageOrVideo from "@/components/ui/ImageOrVideo"; import GridOrCarousel from "@/components/ui/GridOrCarousel"; -import useProducts from "@/hooks/useProducts"; + +type Product = { + name: string; + price: string; + imageSrc: string; + description?: string; + onClick?: () => void; +}; type ProductMediaCardsProps = { tag: string; @@ -12,12 +17,7 @@ type ProductMediaCardsProps = { description: string; primaryButton?: { text: string; href: string }; secondaryButton?: { text: string; href: string }; - products?: { - name: string; - price: string; - imageSrc: string; - onClick?: () => void; - }[]; + products?: Product[]; }; const ProductMediaCards = ({ @@ -26,35 +26,10 @@ const ProductMediaCards = ({ description, primaryButton, secondaryButton, - products: productsProp, + products = [], }: ProductMediaCardsProps) => { - const { products: fetchedProducts, isLoading } = useProducts(); - const isFromApi = fetchedProducts.length > 0; - const products = isFromApi - ? fetchedProducts.map((p) => ({ - name: p.name, - price: p.price, - imageSrc: p.imageSrc, - onClick: p.onProductClick, - })) - : productsProp; - - if (isLoading && !productsProp) { - return ( - - - - - - ); - } - - if (!products || products.length === 0) { - return null; - } - return ( - + {tag} @@ -87,28 +62,36 @@ const ProductMediaCards = ({ viewport={{ once: true, margin: "-15%" }} transition={{ duration: 0.6, ease: "easeOut" }} > - - {products.map((product) => ( - - - - - - - - {product.name} - {product.price} + + {products.map((product, index) => ( + + + {/* Front */} + + + + + + {product.name} + {product.price} + + {product.onClick && ( + + )} - - - + + {/* Back */} + + {product.name} + + {product.description || "Detailed description of the product goes here. This side reveals more information about the features, materials, and specifications."} + + {product.onClick && ( + + )} - + ))} @@ -117,4 +100,4 @@ const ProductMediaCards = ({ ); }; -export default ProductMediaCards; +export default ProductMediaCards; \ No newline at end of file
{product.price}
+ {product.description || "Detailed description of the product goes here. This side reveals more information about the features, materials, and specifications."} +