+
+

+
-
- );
-});
-
-ProductCardItem.displayName = "ProductCardItem";
-
-const ProductCardTwo = ({
- products: productsProp,
- carouselMode = "buttons",
- gridVariant,
- uniformGridCustomHeightClasses = "min-h-95 2xl:min-h-105",
- animationType,
- title,
- titleSegments,
- description,
- tag,
- tagIcon,
- tagAnimation,
- buttons,
- buttonAnimation,
- textboxLayout,
- useInvertedBackground,
- ariaLabel = "Product section",
- className = "",
- containerClassName = "",
- cardClassName = "",
- imageClassName = "",
- textBoxTitleClassName = "",
- textBoxTitleImageWrapperClassName = "",
- textBoxTitleImageClassName = "",
- textBoxDescriptionClassName = "",
- cardBrandClassName = "",
- cardNameClassName = "",
- cardPriceClassName = "",
- cardRatingClassName = "",
- actionButtonClassName = "",
- gridClassName = "",
- carouselClassName = "",
- controlsClassName = "",
- textBoxClassName = "",
- textBoxTagClassName = "",
- textBoxButtonContainerClassName = "",
- textBoxButtonClassName = "",
- textBoxButtonTextClassName = "",
-}: ProductCardTwoProps) => {
- const theme = useTheme();
- const router = useRouter();
- const { products: fetchedProducts, isLoading } = useProducts();
- const isFromApi = fetchedProducts.length > 0;
- const products = (fetchedProducts.length > 0 ? fetchedProducts : productsProp) as ProductCard[];
- const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle);
-
- const handleProductClick = useCallback((product: ProductCard) => {
- if (isFromApi) {
- router.push(`/shop/${product.id}`);
- } else {
- product.onProductClick?.();
- }
- }, [isFromApi, router]);
-
- const customGridRows = (gridVariant === "bento-grid" || gridVariant === "bento-grid-inverted")
- ? "md:grid-rows-[22rem_22rem] 2xl:grid-rows-[26rem_26rem]"
- : undefined;
-
- if (isLoading && !productsProp) {
- return (
-
- );
- }
-
- if (!products || products.length === 0) {
- return null;
- }
-
- return (
-
- {products?.map((product, index) => (
- handleProductClick(product) }}
- shouldUseLightText={shouldUseLightText}
- cardClassName={cardClassName}
- imageClassName={imageClassName}
- cardBrandClassName={cardBrandClassName}
- cardNameClassName={cardNameClassName}
- cardPriceClassName={cardPriceClassName}
- cardRatingClassName={cardRatingClassName}
- actionButtonClassName={actionButtonClassName}
- />
- ))}
-
- );
+
{product.name}
+
{product.price}
+
+