UNPKG

@shopgate/engage

Version:
37 lines (36 loc) 977 B
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} */ import { jsx as _jsx } from "react/jsx-runtime"; const PriceDifference = ({ className, currency, difference }) => { if (difference === 0) { return null; } const priceClassName = classNames(className, { [styles.positive]: difference > 0, [styles.negative]: difference < 0 }); return /*#__PURE__*/_jsx(Price, { className: priceClassName, currency: currency, unitPrice: difference }); }; PriceDifference.defaultProps = { className: '' }; export default PriceDifference;