Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Rename crossSellsProduct to product
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslange committed Sep 8, 2022
1 parent d4ae746 commit 8f1c545
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { Block as ProductButton } from '../../../atomic/blocks/product-elements/
import AddToCartButton from '../../../atomic/blocks/product-elements/add-to-cart/block';

interface CrossSellsProductProps {
crossSellsProduct: ProductResponseItem;
product: ProductResponseItem;
isLoading: boolean;
}

const CartCrossSellsProduct = ( {
crossSellsProduct,
product,
}: CrossSellsProductProps ): JSX.Element => {
return (
<div className="cross-sells-product">
Expand All @@ -35,7 +35,7 @@ const CartCrossSellsProduct = ( {
<ProductDataContextProvider
// Setting isLoading to false, given this parameter is required.
isLoading={ false }
product={ crossSellsProduct }
product={ product }
>
<div>
<ProductImage
Expand All @@ -51,7 +51,7 @@ const CartCrossSellsProduct = ( {
<ProductSaleBadge />
<ProductPrice />
</div>
{ crossSellsProduct.is_in_stock ? (
{ product.is_in_stock ? (
<AddToCartButton />
) : (
<ProductButton />
Expand Down
14 changes: 8 additions & 6 deletions assets/js/blocks/cart/cart-cross-sells-product-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ import { ProductResponseItem } from '@woocommerce/type-defs/product-response';
import CartCrossSellsProduct from './cart-cross-sells-product';

interface CrossSellsProductListProps {
crossSellsProducts: ProductResponseItem[];
products: ProductResponseItem[];
className?: string | undefined;
columns: number;
}

const CartCrossSellsProductList = ( {
crossSellsProducts,
products,
columns,
}: CrossSellsProductListProps ): JSX.Element => {
const products = crossSellsProducts.map( ( crossSellsProduct, i ) => {
const crossSellsProducts = products.map( ( product, i ) => {
if ( i >= columns ) return null;

return (
<CartCrossSellsProduct
crossSellsProduct={ crossSellsProduct }
key={ crossSellsProduct.id }
// Setting isLoading to false, given this parameter is required.
isLoading={ false }
product={ product }
key={ product.id }
/>
);
} );

return <div>{ products }</div>;
return <div>{ crossSellsProducts }</div>;
};

export default CartCrossSellsProductList;

0 comments on commit 8f1c545

Please sign in to comment.