UNPKG

@shopgate/engage

Version:
4 lines 1.41 kB
import*as React from'react';import{SurroundPortals}from'@shopgate/engage/components';import{CART_PAYMENT_BAR_TOTALS_GRAND_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"./PaymentBarGrandTotal.connector";/** * The GrandTotal component. * @returns {JSX} */function PaymentBarGrandTotal(_ref){var amount=_ref.amount,label=_ref.label,showSeparator=_ref.showSeparator,className=_ref.className;var _React$useContext=React.useContext(CartContext),hideTotal=_React$useContext.config.hideTotal,isLoading=_React$useContext.isLoading,currency=_React$useContext.currency,hasPromotionCoupons=_React$useContext.hasPromotionCoupons;if(hideTotal){return null;}return React.createElement(SurroundPortals,{portalName:CART_PAYMENT_BAR_TOTALS_GRAND_TOTAL},React.createElement(CartTotalLine,{isDisabled:isLoading,type:"grandTotal",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})));}PaymentBarGrandTotal.defaultProps={className:null,showSeparator:true,label:'cart.total'};export default connect(PaymentBarGrandTotal);