@ikas/bp-storefront 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,22 +6,23 @@ import { BackInStockNotificationForm, IkasAppliedCampaignAmount, IkasProductAttr
|
|
|
6
6
|
* @ai-related getSelectedProductVariant
|
|
7
7
|
*
|
|
8
8
|
* @param variant - The product variant
|
|
9
|
-
* @returns The first
|
|
9
|
+
* @returns The first IkasProductImage of the variant, or undefined if no images. Access `.image` to get the IkasImage for CDN helpers.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* import { getProductVariantMainImage, getSelectedProductVariant } from "@ikas/bp-storefront";
|
|
13
|
+
* import { getProductVariantMainImage, getSelectedProductVariant, getDefaultSrc } from "@ikas/bp-storefront";
|
|
14
14
|
* import { IkasProduct } from "@ikas/bp-storefront";
|
|
15
15
|
*
|
|
16
16
|
* function ProductImage({ product }: { product: IkasProduct }) {
|
|
17
17
|
* const variant = getSelectedProductVariant(product);
|
|
18
|
-
* const
|
|
18
|
+
* const productImage = getProductVariantMainImage(variant);
|
|
19
|
+
* const image = productImage?.image;
|
|
19
20
|
*
|
|
20
|
-
* if (!
|
|
21
|
+
* if (!image) {
|
|
21
22
|
* return <div className="no-image">No image available</div>;
|
|
22
23
|
* }
|
|
23
24
|
*
|
|
24
|
-
* return <img src={
|
|
25
|
+
* return <img src={getDefaultSrc(image)} alt={product.name} />;
|
|
25
26
|
* }
|
|
26
27
|
* ```
|
|
27
28
|
*/
|