Skip to content

Commit ea94b9b

Browse files
authored
Merge pull request #209 from w3bdesign/development
Trying to fix mobile checkout and cleanup unused files and imports
2 parents e108d15 + ecf90b0 commit ea94b9b

File tree

8 files changed

+31
-63
lines changed

8 files changed

+31
-63
lines changed

components/Cart/CartPage/CartItem.component.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const CartItem = ({
2525
if (process.browser) {
2626
event.stopPropagation();
2727
// Return if the previous update cart mutation request is still processing
28-
2928
if (updateCartProcessing) {
3029
return;
3130
}
@@ -67,7 +66,7 @@ const CartItem = ({
6766
</td>
6867
<td className="px-4 py-2 border">{item.name}</td>
6968
<td className="px-4 py-2 border">
70-
{'string' !== typeof item.price ? item.price.toFixed(2) : item.price}
69+
kr{'string' !== typeof item.price ? item.price.toFixed(2) : item.price}
7170
</td>
7271
<td className="px-4 py-2 border">
7372
<input

components/Cart/CartPage/MobileCart.component.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { v4 } from 'uuid';
22

33
import MobileCartItem from './MobileCartItem.component';
4-
import SVGX from 'components/SVG/SVGX.component';
54

65
const MobileCart = ({ cart, handleRemoveProductClick, updateCart }) => {
76
return (

components/Cart/CartPage/MobileCartItem.component.jsx

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const MobileCartItem = ({
99
products,
1010
handleRemoveProductClick,
1111
updateCart,
12+
updateCartProcessing,
1213
}) => {
1314
const [productCount, setProductCount] = useState(item.qty);
1415

@@ -24,10 +25,9 @@ const MobileCartItem = ({
2425
if (process.browser) {
2526
event.stopPropagation();
2627
// Return if the previous update cart mutation request is still processing
27-
/*
2828
if (updateCartProcessing) {
2929
return;
30-
}*/
30+
}
3131
// If the user tries to delete the count of product, set that to 1 by default ( This will not allow him to reduce it less than zero )
3232
const newQty = event.target.value ? parseInt(event.target.value) : 1;
3333
// Set the new quantity in state.
@@ -49,32 +49,30 @@ const MobileCartItem = ({
4949
return (
5050
<>
5151
<tr className="flex flex-col mb-2 flex-no wrap sm:table-row sm:mb-0">
52-
<td className="h-12 p-3 border-2 border-gray-400 ">
53-
<SVGX
54-
cartKey={item.cartKey}
55-
handleRemoveProductClick={handleRemoveProductClick}
56-
products={products}
57-
/>
58-
</td>
59-
<td className="h-12 p-3 border-l-2 border-r-2 border-gray-400 ">
60-
{item.name}
52+
<td className="h-12 p-3">
53+
<SVGX
54+
cartKey={item.cartKey}
55+
handleRemoveProductClick={handleRemoveProductClick}
56+
products={products}
57+
/>
6158
</td>
62-
<td className="h-12 p-3 border-2 border-gray-400 ">
63-
{'string' !== typeof item.price ? item.price.toFixed(2) : item.price}
59+
<td className="h-12 p-3">{item.name}</td>
60+
<td className="h-12 p-3">
61+
kr{'string' !== typeof item.price ? item.price.toFixed(2) : item.price}
6462
</td>
65-
<td className="h-12 p-3 border-l-2 border-r-2 border-gray-400 ">
66-
<input
67-
className="w-12"
68-
type="number"
69-
min="1"
70-
defaultValue={productCount}
71-
onChange={(event) => handleQuantityChange(event, item.cartKey)}
72-
/>
63+
<td className="h-12 p-3">
64+
<input
65+
className="w-12"
66+
type="number"
67+
min="1"
68+
defaultValue={productCount}
69+
onChange={(event) => handleQuantityChange(event, item.cartKey)}
70+
/>
7371
</td>
74-
<td className="h-12 p-3 border-2 border-gray-400 ">
75-
{'string' !== typeof item.totalPrice
76-
? item.totalPrice.toFixed(2)
77-
: item.totalPrice}
72+
<td className="h-12 p-3">
73+
{'string' !== typeof item.totalPrice
74+
? item.totalPrice.toFixed(2)
75+
: item.totalPrice}
7876
</td>
7977
</tr>
8078
</>

components/Checkout/Billing.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Billing = ({ onSubmit }) => {
3434
<>
3535
<section className="relative text-gray-700 body-font">
3636
<form onSubmit={handleSubmit(onSubmit)}>
37-
<div className="container px-5 py-2 mx-auto">
37+
<div className="container py-2 mx-auto ml-8">
3838
<CheckoutTitle title="Betalingsdetaljer" />
3939
<div className="mx-auto lg:w-1/2 md:w-2/3">
4040
<div className="flex flex-wrap -m-2">

components/Checkout/CheckoutForm.component.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import LoadingSpinner from '../LoadingSpinner/LoadingSpinner.component';
88

99
import { GET_CART } from 'utils/const/GQL_QUERIES';
1010
import { CHECKOUT_MUTATION } from 'utils/const/GQL_MUTATIONS';
11-
import { INITIAL_STATE } from 'utils/const/INITIAL_STATE';
1211

1312
import { AppContext } from 'utils/context/AppContext';
1413

@@ -19,7 +18,7 @@ import {
1918

2019
const CheckoutForm = () => {
2120
const [cart, setCart] = useContext(AppContext);
22-
const [input, setInput] = useState(INITIAL_STATE);
21+
2322
const [orderData, setOrderData] = useState(null);
2423
const [requestError, setRequestError] = useState(null);
2524
const [orderCompleted, setorderCompleted] = useState(false);

components/Checkout/OrderDetails.component.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const OrderDetails = ({ cart }) => {
99
{cart ? (
1010
<div className="p-6 mx-auto mt-5">
1111
<CheckoutTitle title="Handlekurv" />
12-
1312
<table className="table-auto">
1413
<thead>
1514
<tr>
@@ -34,10 +33,7 @@ const OrderDetails = ({ cart }) => {
3433
<OrderDetailsCartItem
3534
key={item.productId}
3635
item={item}
37-
products={cart.products}
38-
// updateCartProcessing={updateCartProcessing}
39-
// handleRemoveProductClick={handleRemoveProductClick}
40-
// updateCart={updateCart}
36+
products={cart.products}
4137
/>
4238
))}
4339
</tbody>

styles/index.css

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
@tailwind components;
33

44
#hero {
5-
/*background-image: url('https://images.unsplash.com/photo-1422190441165-ec2956dc9ecc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80');*/
6-
background-image: url("../public/images/hero.jpg");
7-
height:385px;
8-
/*height: 24rem;*/
5+
background-image: url('../public/images/hero.jpg');
6+
height: 24rem;
97
}
108

119
#mobile-menu {
@@ -26,8 +24,8 @@
2624

2725
/* Fix for annoying CSS bug with NavBar moving slightly on front page only */
2826
/*@media only screen and (min-width: 769px) {*/
29-
30-
@media only screen and (min-width: 1600px) {
27+
28+
@media only screen and (min-width: 1600px) {
3129
#navbar-div {
3230
margin-left: 330px;
3331
}

utils/const/INITIAL_STATE.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)