Skip to content

Commit d8e7341

Browse files
committed
Add loadingspinner to provide feedback during checkout process
1 parent 22c402e commit d8e7341

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

components/Checkout/CheckoutForm.component.jsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { useState, useContext, useEffect } from 'react';
22
import { useQuery, useMutation } from '@apollo/react-hooks';
33

44
import Billing from './Billing.component';
5-
import OrderDetails from "./OrderDetails.component";
5+
import OrderDetails from './OrderDetails.component';
6+
import LoadingSpinner from '../LoadingSpinner/LoadingSpinner.component';
67
//import Payment from './Payment.component';
78

89
import { GET_CART } from 'utils/const/GQL_QUERIES';
@@ -102,22 +103,31 @@ const CheckoutForm = () => {
102103
{cart ? (
103104
<form onSubmit={handleFormSubmit} className="">
104105
<div className="container mx-auto">
105-
{/* Order*/}
106-
106+
{/* Order*/}
107+
107108
<OrderDetails cart={cart} />
108-
{/*Payment Details*/}
109-
<div className="">
110-
<Billing input={input} handleOnChange={handleOnChange} />
109+
{/*Payment Details*/}
110+
<div className="">
111+
<Billing input={input} handleOnChange={handleOnChange} />
111112
</div>
112-
113113

114114
{/* Checkout Loading*/}
115-
{checkoutLoading}
115+
116+
{checkoutLoading && (
117+
<div className="text-xl text-center">
118+
Behandler ordre, vennligst vent ...
119+
<br />
120+
<LoadingSpinner />
121+
</div>
122+
)}
123+
116124
{requestError}
117125
</div>
118126
</form>
119127
) : (
120-
''
128+
<div className="container m-12 mx-auto text-xl text-center">
129+
Takk for din ordre!
130+
</div>
121131
)}
122132
</>
123133
);

0 commit comments

Comments
 (0)