UNPKG

@shopgate/engage

Version:
5 lines 736 B
import*as React from'react';import{COUPON_TYPE_FIXED,COUPON_TYPE_PERCENTAGE}from'@shopgate/pwa-common-commerce/cart';import Price from'@shopgate/pwa-ui-shared/Price';import styles from"./CartItemCouponPrice.style";/** * The Coupon Price component. * @param {Object} props The component properties. * @returns {JSX} */export var CartItemCouponPrice=React.memo(function(_ref){var currency=_ref.currency,savedPrice=_ref.savedPrice;if(savedPrice.type===COUPON_TYPE_FIXED){return React.createElement(Price,{className:styles,currency:currency,discounted:true,unitPrice:-savedPrice.value});}if(savedPrice.type===COUPON_TYPE_PERCENTAGE){return React.createElement("span",{className:styles},"-".concat(savedPrice.value,"%"));}return null;});