Product Tile
This page illustrates composing @hv/commerce/ui
components to render a product tile
Components Used
<ProductImage />
<ProductName />
<ProductPricing />
<ProductVariationSelection />
<ProductAddtoCart />
Example
- Preview
- Code
VividLux OLED TV$599.99
import React from 'react';
import {
ProductAddToCart,
ProductAddToCartError,
ProductImage,
ProductName,
} from '@hv/commerce/ui/product';
import { ProductPricing } from '@hv/commerce/ui/product-pricing';
import * as UIProductTile from '@hv/commerce/ui/product-tile';
import { ProductStaticProvider } from '@hv/commerce/ui/product-static-provider';
export const ProductTile = ({ product, variationProducts }) => {
if (!product) {
return null;
}
return (
<ProductStaticProvider
product={product}
variationProducts={variationProducts}
>
<UIProductTile.Content>
<ProductImage isLink zoomOnHover />
<ProductName isLink />
<ProductPricing />
<UIProductTile.VariationSelection
strings={{
unavailable: 'Unavailable',
}}
/>
<ProductAddToCart
strings={{
addToCart: 'Add to Cart',
}}
/>
<ProductAddToCartError strings={{}} />
</UIProductTile.Content>
</ProductStaticProvider>
);
};
export default ProductTile;