diff --git a/packages/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js b/packages/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js index bbaabfa047..a5df9d879f 100644 --- a/packages/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +++ b/packages/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js @@ -1,5 +1,5 @@ -import { useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; +import { useEffect, useCallback } from 'react'; +import { useHistory, useRouteMatch } from 'react-router-dom'; import { useLazyQuery } from '@apollo/react-hooks'; import { useCartContext } from '@magento/peregrine/lib/context/cart'; @@ -28,10 +28,10 @@ export const usePriceSummary = props => { } = props; const [{ cartId }] = useCartContext(); - - const location = useLocation(); + const history = useHistory(); // We don't want to display "Estimated" or the "Proceed" button in checkout. - const isCheckout = location.pathname === '/checkout'; + const match = useRouteMatch('/checkout'); + const isCheckout = !!match; const [fetchPriceSummary, { error, loading, data }] = useLazyQuery( getPriceSummary @@ -53,7 +53,12 @@ export const usePriceSummary = props => { } }, [error]); + const handleProceedToCheckout = useCallback(() => { + history.push('/checkout'); + }, [history]); + return { + handleProceedToCheckout, hasError: !!error, hasItems: data && !!data.cart.items.length, isCheckout, diff --git a/packages/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js b/packages/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js index 88540b9026..7a98c043c8 100644 --- a/packages/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js +++ b/packages/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js @@ -10,7 +10,6 @@ import GiftCardSummary from './giftCardSummary'; import ShippingSummary from './shippingSummary'; import TaxSummary from './taxSummary'; import { PriceSummaryFragment } from './priceSummaryFragments'; -import { Link } from '@magento/venia-drivers'; const GET_PRICE_SUMMARY = gql` query getPriceSummary($cartId: String!) { @@ -40,7 +39,14 @@ const PriceSummary = props => { } }); - const { hasError, hasItems, isCheckout, isLoading, flatData } = talonProps; + const { + handleProceedToCheckout, + hasError, + hasItems, + isCheckout, + isLoading, + flatData + } = talonProps; if (hasError) { return ( @@ -61,10 +67,12 @@ const PriceSummary = props => { const proceedToCheckoutButton = !isCheckout ? (
-
) : null; diff --git a/packages/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.css b/packages/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.css index bc337aff96..4c79ec041b 100644 --- a/packages/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.css +++ b/packages/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.css @@ -40,6 +40,6 @@ @media (max-width: 960px) { .heading { - border: unset; + border-width: 0; } } diff --git a/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.css b/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.css index a642fafa9e..bdf3616ae0 100644 --- a/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.css +++ b/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.css @@ -64,7 +64,7 @@ margin-bottom: 1.5rem; } -.summary_container { +.summaryContainer { grid-column: 2 / span 1; grid-row: 1 / span 1; height: 0; @@ -92,7 +92,7 @@ gap: 1rem; } - .summary_container { + .summaryContainer { grid-column: 1 / span 1; grid-row: unset; height: auto; @@ -105,6 +105,6 @@ .payment_information_heading { composes: stepper_heading; /* On mobile, order summary has a top border, so avoid doubling up. */ - border-bottom: unset; + border-bottom-width: 0; } } diff --git a/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.js b/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.js index a3574fc453..10d84d5acb 100644 --- a/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.js +++ b/packages/venia-ui/lib/components/CheckoutPage/checkoutPage.js @@ -123,19 +123,21 @@ const CheckoutPage = props => { ); const orderSummary = shouldRenderPriceSummary ? ( -
+
) : null; + const guestCheckoutHeaderText = isGuestCheckout + ? 'Guest Checkout' + : 'Review and Place Order'; + content = ( {loginButton}

- {isGuestCheckout - ? 'Guest Checkout' - : 'Review and Place Order'} + {guestCheckoutHeaderText}