@shopgate/engage
Version:
Shopgate's ENGAGE library.
3 lines • 1.3 kB
JavaScript
import*as React from'react';import{SurroundPortals}from'@shopgate/engage/components';import{CART_PAYMENT_BAR_TOTALS_SUB_TOTAL}from'@shopgate/pwa-common-commerce/cart/constants/Portals';import CartTotalLine from'@shopgate/pwa-ui-shared/CartTotalLine';import{CartContext}from"../../cart.context";import{spacer}from"./PaymentBarContent.style";import connect from"./PaymentBarSubTotal.connector";/**
* @returns {JSX}
*/function PaymentBarSubTotal(_ref){var amount=_ref.amount,label=_ref.label,showSeparator=_ref.showSeparator,className=_ref.className;var _React$useContext=React.useContext(CartContext),currency=_React$useContext.currency,isLoading=_React$useContext.isLoading,hasPromotionCoupons=_React$useContext.hasPromotionCoupons;return React.createElement(SurroundPortals,{portalName:CART_PAYMENT_BAR_TOTALS_SUB_TOTAL},amount&&React.createElement(CartTotalLine,{isDisabled:isLoading,type:"subTotal",className:className},React.createElement(CartTotalLine.Label,{label:label,showSeparator:showSeparator}),React.createElement(CartTotalLine.Amount,{amount:amount,currency:currency}),hasPromotionCoupons&&React.createElement(CartTotalLine.Spacer,{className:spacer})));}PaymentBarSubTotal.defaultProps={className:null,showSeparator:true,label:'cart.subtotal'};export default connect(PaymentBarSubTotal);