mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2024-12-25 06:00:43 -05:00
as good as itll get
This commit is contained in:
parent
aca34ffb10
commit
907aac1b75
2 changed files with 39 additions and 9 deletions
|
@ -66,7 +66,10 @@ function OrderSummary({ cart }) {
|
||||||
</p>
|
</p>
|
||||||
<p>Shipping (10%): ${currencyFormat(shippingCosts)}</p>
|
<p>Shipping (10%): ${currencyFormat(shippingCosts)}</p>
|
||||||
<p>Total: ${currencyFormat(total)}</p>
|
<p>Total: ${currencyFormat(total)}</p>
|
||||||
<Button text={"Checkout"} />
|
<Button
|
||||||
|
text={"Checkout"}
|
||||||
|
onClick={() => alert("Congrats! You would've leveled up")}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -80,15 +83,21 @@ function CartItem({ item, cart, setCart }) {
|
||||||
<div className={styles.card}>
|
<div className={styles.card}>
|
||||||
<div>
|
<div>
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
<p>Price: ${currencyFormat(price)} x </p>
|
<div className={styles["price-qty"]}>
|
||||||
</div>
|
<p> ${currencyFormat(price)} x </p>
|
||||||
<div className={styles.qtybtn}>
|
<div className={styles.qtybtn}>
|
||||||
<button onClick={() => decreaseQty(item, cart, setCart)}>-</button>
|
<button onClick={() => decreaseQty(item, cart, setCart)}>
|
||||||
<QuantityInput item={item} cart={cart} setCart={setCart} />
|
-
|
||||||
<button onClick={() => increaseQty(item, cart, setCart)}>+</button>
|
</button>
|
||||||
|
<QuantityInput item={item} cart={cart} setCart={setCart} />
|
||||||
|
<button onClick={() => increaseQty(item, cart, setCart)}>
|
||||||
|
+
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p>Item total: ${currencyFormat(qty * price)} </p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>total: ${currencyFormat(qty * price)} </p>
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => removeFromCart(item, cart, setCart)}
|
onClick={() => removeFromCart(item, cart, setCart)}
|
||||||
text={"Remove From Cart"}
|
text={"Remove From Cart"}
|
||||||
|
@ -112,7 +121,14 @@ function QuantityInput({ item, cart, setCart }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input value={item.qty} onChange={handleChange} min="1" type="number" />
|
<input
|
||||||
|
value={item.qty}
|
||||||
|
onChange={handleChange}
|
||||||
|
min="1"
|
||||||
|
max="999"
|
||||||
|
type="number"
|
||||||
|
className={styles.input}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,16 @@
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.price-qty {
|
||||||
|
display: flex;
|
||||||
|
gap: 30px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price-qty p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.qtybtn {
|
.qtybtn {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@ -81,3 +91,7 @@
|
||||||
.header {
|
.header {
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
max-width: 30px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue