Skip to content

Commit

Permalink
Empty cart message added
Browse files Browse the repository at this point in the history
  • Loading branch information
UjjwalGupta1105 committed May 21, 2024
1 parent f20b726 commit 0d5c54b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
33 changes: 7 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/Components/CartItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import removeIcon from "../assets/cart_cross_icon.png";
import AddIcon from "@mui/icons-material/Add";
import RemoveIcon from "@mui/icons-material/Remove";
import {loadStripe} from '@stripe/stripe-js';
import img from "../assets/emptycart_img.png"

const CartItems = () => {
const {
Expand All @@ -15,6 +16,8 @@ const CartItems = () => {
AddToCart,
} = useContext(ShopContext);

const isEmptyCart = getCartTotalAmount()=== 0;

//payment gateway
const makePayment = async()=>{
const stripe = await loadStripe("Enter Your Stripe Public Key Here");
Expand Down Expand Up @@ -64,6 +67,16 @@ console.log(cartItem)
<p className="font-bold">Remove</p>
</div>
<hr />

{ isEmptyCart&&(
<div>
<img
src={img}
className="m-auto flex-initial"
/>
</div>
)}

{all_products &&
all_products.map((item) => {
if (cartItem[item.id] > 0) {
Expand Down
Binary file added src/assets/emptycart_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0d5c54b

Please sign in to comment.