Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 8 & Issue 4 fixed #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion src/Components/Cart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { XIcon } from "@heroicons/react/outline";
import React, { Fragment } from "react";

export default function Cart({ open, setOpen, cart, updateCart }) {
var subtotal = 0;
cart.forEach(product => {
subtotal += product.price
})
return (
<Transition.Root show={open} as={Fragment}>
<Dialog
Expand Down Expand Up @@ -105,7 +109,7 @@ export default function Cart({ open, setOpen, cart, updateCart }) {
<div className="border-t border-gray-200 py-6 px-4 sm:px-6">
<div className="flex justify-between text-base font-medium text-gray-900">
<p>Subtotal</p>
<p>$262.00</p>
<p>{subtotal}</p>
</div>
<p className="mt-0.5 text-sm text-gray-500">Shipping and taxes calculated at checkout.</p>
<div className="mt-6">
Expand Down
3 changes: 2 additions & 1 deletion src/Components/ProductTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export default function ProductTable({ cart, updateCart }) {
setProducts(body);
};
fetchProducts();
});
}, []);


return (
<div className="bg-white">
<div className="max-w-2xl mx-auto px-4 sm:px-6 lg:max-w-7xl lg:px-8">
Expand Down