From c7e200321f6122349e2ef3d7ac0cf81fa3b6cc24 Mon Sep 17 00:00:00 2001 From: kudindmitriy Date: Fri, 27 Feb 2026 00:03:42 +0200 Subject: [PATCH] Bob AI: Add 3D flip animation to product cards on hover. Front side --- .../sections/product/ProductCardFour.tsx | 116 +++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/src/components/sections/product/ProductCardFour.tsx b/src/components/sections/product/ProductCardFour.tsx index 303ff14..53b1afe 100644 --- a/src/components/sections/product/ProductCardFour.tsx +++ b/src/components/sections/product/ProductCardFour.tsx @@ -2,6 +2,8 @@ import { memo, useCallback } from "react"; import { useRouter } from "next/navigation"; + +import { useState } from "react"; import CardStack from "@/components/cardStack/CardStack"; import ProductImage from "@/components/shared/ProductImage"; import { cls, shouldUseInvertedText } from "@/lib/utils"; @@ -68,7 +70,118 @@ interface ProductCardItemProps { actionButtonClassName?: string; } -const ProductCardItem = memo(({ +const ProductCardItemComponent = memo(({ + product, + shouldUseLightText, + cardClassName = "", + imageClassName = "", + cardNameClassName = "", + cardPriceClassName = "", + cardVariantClassName = "", + actionButtonClassName = "", +}: ProductCardItemProps) => { + const [isFlipped, setIsFlipped] = useState(false); + + return ( +
setIsFlipped(true)} + onMouseLeave={() => setIsFlipped(false)} + style={{ + perspective: "1000px", + }} + > +
+ {/* Front Side - Product Image and Name */} +
+
+ +
+
+

+ {product.name} +

+ {product.price && ( +

+ ${product.price} +

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

+ {product.name} +

+ {product.description && ( +

+ {product.description} +

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

+ Variant +

+

+ {product.variant} +

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

+ ${product.price} +

+
+ )} +
+ +
+
+
+ ); +}); + +ProductCardItemComponent.displayName = "ProductCardItem"; + +const ProductCardItem = ProductCardItemComponent; + +const ProductCardItemOld = memo(({ product, shouldUseLightText, cardClassName = "", @@ -170,7 +283,6 @@ const ProductCardFour = ({ } }, [isFromApi, router]); - if (isLoading && !productsProp) { return (