UNPKG

@shopgate/engage

Version:
8 lines 1.11 kB
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import Price from'@shopgate/pwa-ui-shared/Price';import styles from"./style";/** * The price difference component * @param {Object} props The component props * @param {string} props.className A custom css class string. * @param {string} props.currency The currency of the price. * @param {number} props.difference The price difference. * @return {JSX} */var PriceDifference=function PriceDifference(_ref){var className=_ref.className,currency=_ref.currency,difference=_ref.difference;if(difference===0){return null;}var priceClassName=classNames(className,_defineProperty(_defineProperty({},styles.positive,difference>0),styles.negative,difference<0));return React.createElement(Price,{className:priceClassName,currency:currency,unitPrice:difference});};PriceDifference.defaultProps={className:''};export default PriceDifference;