UNPKG

@shopgate/engage

Version:
6 lines 1.67 kB
import React,{Fragment}from'react';import PropTypes from'prop-types';import{Grid,Price,PriceStriked}from'@shopgate/engage/components';import{PriceInfo}from'@shopgate/engage/product/components';import{withPriceCalculation}from'@shopgate/engage/product/hocs';import styles from"./style";/** * The ProductGridPrice component is supposed to be used to display prices at product grids. It * renders a row with the current price and a strike price when present. As same as the price info. * @param {Object} product A product entity. * @return {JSX} */var ProductGridPrice=function ProductGridPrice(_ref){var product=_ref.product;var price=product.price;return React.createElement(Fragment,null,React.createElement(Grid,{className:"".concat(styles.priceWrapper," engage__product__product-grid-price"),wrap:true},React.createElement(Grid.Item,{grow:1},React.createElement(Price,{currency:price.currency,discounted:!!price.discount,unitPrice:price.unitPrice,unitPriceMin:price.unitPriceMin})),price.msrp>0&&price.unitPrice!==price.msrp&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.msrp,currency:price.currency})),!price.msrp&&price.unitPriceStriked>0&&price.unitPrice!==price.unitPriceStriked&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.unitPriceStriked,currency:price.currency}))),React.createElement(PriceInfo,{product:product,className:styles.basicPrice,wrapper:function wrapper(children){return React.createElement(Grid,null,React.createElement(Grid.Item,null,children));}}));};export default withPriceCalculation(ProductGridPrice);