Skip to content

Commit

Permalink
Check
Browse files Browse the repository at this point in the history
  • Loading branch information
SUGAM-ARORA committed Dec 26, 2024
1 parent 9208496 commit 8db6558
Show file tree
Hide file tree
Showing 7 changed files with 2,585 additions and 1,362 deletions.
3,854 changes: 2,494 additions & 1,360 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"react-dom": "^18.0.0",
"react-helmet": "^6.1.0",
"react-icons": "^5.3.0",
"react-router-dom": "^7.0.1",
"react-intl": "^6.8.7",
"react-scripts": "5.0.1",
"react-router-dom": "^7.0.1",
"react-scripts": "^5.0.1",
"react-toastify": "^10.0.6",
"styled-components": "^6.1.13",
"web-vitals": "^4.2.4"
Expand Down
89 changes: 89 additions & 0 deletions src/Components/cart/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shopping Cart</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
color: #333;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.shopping-cart {
background: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.cart-item {
border-bottom: 1px solid #eee;
padding: 10px 0;
}
.cart-item:last-child {
border-bottom: none;
}
.item-details {
display: flex;
justify-content: space-between;
}
.item-price {
color: #333;
}
.total {
font-weight: bold;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="shopping-cart">
<h2>Your Shopping Cart</h2>
<div id="cart-items"></div>
<div class="total">
Total Items: <span id="total-items">0</span> |
Total Price: $<span id="total-price">0.00</span>
</div>
</div>
</div>

<script>
document.addEventListener('DOMContentLoaded', () => {
const cartItemsContainer = document.getElementById('cart-items');
const totalItemsElement = document.getElementById('total-items');
const totalPriceElement = document.getElementById('total-price');

const cartItems = JSON.parse(localStorage.getItem('cartItems')) || [];

let totalItems = 0;
let totalPrice = 0;

cartItems.forEach(item => {
totalItems += item.quantity;
totalPrice += item.price * item.quantity;

const itemElement = document.createElement('div');
itemElement.classList.add('cart-item');
itemElement.innerHTML = `
<div class="item-details">
<span>${item.name} (x${item.quantity})</span>
<span class="item-price">$${item.price.toFixed(2)}</span>
</div>
`;
cartItemsContainer.appendChild(itemElement);
});

totalItemsElement.textContent = totalItems;
totalPriceElement.textContent = totalPrice.toFixed(2);
});
</script>
</body>
</html>
Binary file added src/Components/projects/card2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Components/projects/card4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/card2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/card4.jpg
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 8db6558

Please sign in to comment.