File tree Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
6
6
import { useQuery , useMutation } from '@apollo/react-hooks' ;
7
7
8
8
import { AppContext } from 'utils/context/AppContext' ;
9
+ import LoadingSpinner from '../LoadingSpinner/LoadingSpinner.component' ;
9
10
10
11
import { GET_CART } from 'utils/const/GQL_QUERIES' ;
11
12
import { ADD_TO_CART } from 'utils/const/GQL_MUTATIONS' ;
@@ -92,6 +93,13 @@ const AddToCartButton = (props) => {
92
93
>
93
94
KJØP
94
95
</ button >
96
+ { addToCartLoading && (
97
+ < div className = "text-xl text-center" >
98
+ Legger i handlekurv, vennligst vent ...
99
+ < br />
100
+ < LoadingSpinner />
101
+ </ div >
102
+ ) }
95
103
</ >
96
104
) ;
97
105
} ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const CartItemsContainer = () => {
40
40
setRequestError ( error ) ;
41
41
} ,
42
42
} ) ;
43
- // TODO We will focus on fetching the cart before we add more functionality
43
+ // TODO Add more functionality
44
44
45
45
return (
46
46
< >
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const CheckoutForm = () => {
24
24
const [ input , setInput ] = useState ( INITIAL_STATE ) ;
25
25
const [ orderData , setOrderData ] = useState ( null ) ;
26
26
const [ requestError , setRequestError ] = useState ( null ) ;
27
+ const [ orderCompleted , setorderCompleted ] = useState ( false ) ;
27
28
28
29
// Checkout GraphQL mutation
29
30
const [
@@ -34,6 +35,7 @@ const CheckoutForm = () => {
34
35
input : orderData ,
35
36
} ,
36
37
onCompleted : ( ) => {
38
+ setorderCompleted ( true ) ;
37
39
refetch ( ) ;
38
40
} ,
39
41
onError : ( error ) => {
@@ -125,9 +127,13 @@ const CheckoutForm = () => {
125
127
</ div >
126
128
</ form >
127
129
) : (
128
- < div className = "container m-12 mx-auto text-xl text-center" >
129
- Takk for din ordre!
130
- </ div >
130
+ < >
131
+ { orderCompleted && (
132
+ < div className = "container m-12 mx-auto text-xl text-center" >
133
+ Takk for din ordre!
134
+ </ div >
135
+ ) }
136
+ </ >
131
137
) }
132
138
</ >
133
139
) ;
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ const rotateAnimation = keyframes`
24
24
` ;
25
25
26
26
const Circle = styled . div `
27
- width: 100px ;
28
- height: 100px ;
27
+ width: 50px ;
28
+ height: 50px ;
29
29
border-radius: 50px;
30
30
border: 10px solid black;
31
31
border-right: 10px solid white;
@@ -42,5 +42,5 @@ const Container = styled.div`
42
42
align-items: center;
43
43
justify-content: center;
44
44
flex-direction: column;
45
- height: 130px ;
45
+ height: 110px ;
46
46
` ;
You can’t perform that action at this time.
0 commit comments