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';
66import { useQuery , useMutation } from '@apollo/react-hooks' ;
77
88import { AppContext } from 'utils/context/AppContext' ;
9+ import LoadingSpinner from '../LoadingSpinner/LoadingSpinner.component' ;
910
1011import { GET_CART } from 'utils/const/GQL_QUERIES' ;
1112import { ADD_TO_CART } from 'utils/const/GQL_MUTATIONS' ;
@@ -92,6 +93,13 @@ const AddToCartButton = (props) => {
9293 >
9394 KJØP
9495 </ button >
96+ { addToCartLoading && (
97+ < div className = "text-xl text-center" >
98+ Legger i handlekurv, vennligst vent ...
99+ < br />
100+ < LoadingSpinner />
101+ </ div >
102+ ) }
95103 </ >
96104 ) ;
97105} ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const CartItemsContainer = () => {
4040 setRequestError ( error ) ;
4141 } ,
4242 } ) ;
43- // TODO We will focus on fetching the cart before we add more functionality
43+ // TODO Add more functionality
4444
4545 return (
4646 < >
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const CheckoutForm = () => {
2424 const [ input , setInput ] = useState ( INITIAL_STATE ) ;
2525 const [ orderData , setOrderData ] = useState ( null ) ;
2626 const [ requestError , setRequestError ] = useState ( null ) ;
27+ const [ orderCompleted , setorderCompleted ] = useState ( false ) ;
2728
2829 // Checkout GraphQL mutation
2930 const [
@@ -34,6 +35,7 @@ const CheckoutForm = () => {
3435 input : orderData ,
3536 } ,
3637 onCompleted : ( ) => {
38+ setorderCompleted ( true ) ;
3739 refetch ( ) ;
3840 } ,
3941 onError : ( error ) => {
@@ -125,9 +127,13 @@ const CheckoutForm = () => {
125127 </ div >
126128 </ form >
127129 ) : (
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+ </ >
131137 ) }
132138 </ >
133139 ) ;
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ const rotateAnimation = keyframes`
2424` ;
2525
2626const Circle = styled . div `
27- width: 100px ;
28- height: 100px ;
27+ width: 50px ;
28+ height: 50px ;
2929 border-radius: 50px;
3030 border: 10px solid black;
3131 border-right: 10px solid white;
@@ -42,5 +42,5 @@ const Container = styled.div`
4242 align-items: center;
4343 justify-content: center;
4444 flex-direction: column;
45- height: 130px ;
45+ height: 110px ;
4646` ;
You can’t perform that action at this time.
0 commit comments