UNPKG

@shopgate/engage

Version:
4 lines 1.03 kB
import React from'react';import PropTypes from'prop-types';import noop from'lodash/noop';import UnitQuantityPicker from"./UnitQuantityPicker";import{small,big}from"./styles";/** * @param {Object} props The component props. * @returns {JSX} */var CartUnitQuantityPicker=function CartUnitQuantityPicker(_ref){var unit=_ref.unit,value=_ref.value,onChange=_ref.onChange,classNames=_ref.classNames,hasCatchWeight=_ref.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;var withDecimals=classNames.withDecimals,withoutDecimals=classNames.withoutDecimals;return React.createElement(UnitQuantityPicker,{className:!hasUnitWithDecimals?withDecimals:withoutDecimals,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:onChange,value:value});};CartUnitQuantityPicker.defaultProps={unit:null,onChange:noop,classNames:{withDecimals:big,withoutDecimals:small},hasCatchWeight:false};export default CartUnitQuantityPicker;