From be728592c17751d657a6a76ce4546b01da26f7a5 Mon Sep 17 00:00:00 2001 From: kudindmitriy Date: Thu, 26 Feb 2026 13:55:28 +0000 Subject: [PATCH] Bob AI: Add 3D flip animation to product cards on hover. Front side --- .../sections/product/ProductCardFour.tsx | 103 +++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/src/components/sections/product/ProductCardFour.tsx b/src/components/sections/product/ProductCardFour.tsx index 303ff14..b14a8fa 100644 --- a/src/components/sections/product/ProductCardFour.tsx +++ b/src/components/sections/product/ProductCardFour.tsx @@ -2,6 +2,9 @@ import { memo, useCallback } from "react"; import { useRouter } from "next/navigation"; +"use client"; + +import { useState } from "react"; import CardStack from "@/components/cardStack/CardStack"; import ProductImage from "@/components/shared/ProductImage"; import { cls, shouldUseInvertedText } from "@/lib/utils"; @@ -68,7 +71,7 @@ interface ProductCardItemProps { actionButtonClassName?: string; } -const ProductCardItem = memo(({ +const FlipCard = memo(({ product, shouldUseLightText, cardClassName = "", @@ -77,6 +80,104 @@ const ProductCardItem = memo(({ cardPriceClassName = "", cardVariantClassName = "", actionButtonClassName = "", +}: ProductCardItemProps) => { + const [isFlipped, setIsFlipped] = useState(false); + + return ( +
setIsFlipped(true)} + onMouseLeave={() => setIsFlipped(false)} + > +
+ {/* Front Side - Product Image and Name */} +
+
+
+ +
+
+

+ {product.name} +

+ {product.price && ( +

+ ${product.price} +

+ )} +
+
+
+ + {/* Back Side - Product Details */} +
+
+

+ {product.name} +

+ {product.description && ( +

+ {product.description} +

+ )} + {product.ingredients && ( +
+

+ Ingredients: +

+

+ {product.ingredients} +

+
+ )} +
+ {product.price && ( +

+ ${product.price} +

+ )} +
+
+
+ ); +}); + +FlipCard.displayName = "FlipCard"; + +const ProductCardItem = memo(({ + product, + shouldUseLightText, + cardClassName = "rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm hover:shadow-md transition-shadow", + imageClassName = "", + cardNameClassName = "", + cardPriceClassName = "", + cardVariantClassName = "", + actionButtonClassName = "", }: ProductCardItemProps) => { return (