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

Nikita #142

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
final commit
issverg committed Dec 11, 2024
commit 77ddbd4e4330d2e6603cae32ce48f4c2eaf842a4
9 changes: 2 additions & 7 deletions src/CartItem.jsx
Original file line number Diff line number Diff line change
@@ -8,10 +8,7 @@ const CartItem = ({ onContinueShopping }) => {
const dispatch = useDispatch();

// Calculate total amount for all products in the cart
const calculateTotalAmount = () => {
cart.reduce((sum, item) => sum + item.quantity * item.cost, 0);
};

const calculateTotalAmount = () => cart.reduce((sum, item) => sum + (item.quantity * item.cost.slice(1)), 0);
const handleContinueShopping = (e) => {
onContinueShopping();
};
@@ -36,9 +33,7 @@ const handleCheckoutShopping = (e) => {
};

// Calculate total cost based on quantity for an item
const calculateTotalCost = (item) => {
return item.quantity * item.cost;
};
const calculateTotalCost = (item) => item.quantity * item.cost.slice(1);

return (
<div className="cart-container">