diff --git a/src/Components/Login.css b/src/Components/Login.css index d213dfe4..d060f040 100644 --- a/src/Components/Login.css +++ b/src/Components/Login.css @@ -232,7 +232,6 @@ form.sign-in-form { grid-template-columns: repeat(2, 1fr); } - .container1:before { content: ""; position: absolute; @@ -248,7 +247,7 @@ form.sign-in-form { darkturquoise 100% ); transition: 1.8s ease-in-out; - border-radius: 80%; + border-radius: 50% 50% 0 0; /* Changed to a semi-circle */ z-index: 6; } diff --git a/src/Components/cart/12.png b/src/Components/cart/12.png new file mode 100644 index 00000000..f1c07cec Binary files /dev/null and b/src/Components/cart/12.png differ diff --git a/src/Components/cart/cart.css b/src/Components/cart/cart.css index 86ca0510..60d62968 100644 --- a/src/Components/cart/cart.css +++ b/src/Components/cart/cart.css @@ -1,84 +1,85 @@ body { - font-family: Arial, sans-serif; - margin: 0; - padding: 0; - background-color: #1f1c35; - color: white; - } - - .cart-container { - text-align: center; - margin-top: 50px; - } - - .cart-top { - position: fixed; - top: 10px; - right: 10px; - background-color: #ff21bc; - padding: 10px; - border-radius: 50%; - color: white; - cursor: pointer; - display: flex; - align-items: center; - } - - .cart-icon { - width: 24px; - height: 24px; - vertical-align: middle; - margin-right: 10px; - } - - .cart-count { - margin-left: 5px; - font-size: 16px; - } - - .cart-item { - border: 1px solid #ddd; - padding: 10px; - margin: 10px; - display: inline-block; - width: calc(33% - 40px); - box-sizing: border-box; - text-align: left; - box-shadow: 7px 7px 32px 0 #6052ff; - position: relative; - } - - .add-to-cart, - .remove-from-cart { - background-color: #ff21bc; - color: #fff; - border: none; - padding: 10px; - position: absolute; - bottom: 10px; - left: 30%; - transform: translateX(-50%); - border-radius: 3px; - cursor: pointer; - } - - .remove-from-cart { - left: 70%; - } - - .shop-today a { - color: #007185; - text-decoration: none; - font-weight: bold; - } - - .cart-signin button { - background-color: #ff21bc; - border: 1px solid #a88734 #9c7e31 #846a29; - color: #fff; - padding: 10px 20px; - margin: 10px; - cursor: pointer; - border-radius: 3px; - } - \ No newline at end of file + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #1f1c35; + color: white; +} + +.cart-container { + text-align: center; + margin-top: 50px; +} + +.cart-top { + position: fixed; + top: 10px; + right: 10px; + background-color: #ff21bc; + padding: 10px; + border-radius: 50%; + color: white; + cursor: pointer; + display: flex; + align-items: center; +} + +.cart-icon { + width: 24px; + height: 24px; + vertical-align: middle; + margin-right: 10px; +} + +.cart-count { + margin-left: 5px; + font-size: 16px; +} + +.cart-item { + border: 1px solid #ddd; + padding: 10px; + margin: 10px; + display: inline-block; + width: calc(33% - 40px); + box-sizing: border-box; + text-align: left; + box-shadow: 7px 7px 32px 0 #6052ff; + position: relative; +} + +.add-to-cart, +.remove-from-cart { + background-color: #ff21bc; + color: #fff; + border: none; + padding: 10px; + position: absolute; + bottom: 10px; + left: 30%; + transform: translateX(-50%); + border-radius: 3px; + cursor: pointer; +} + +.remove-from-cart { + left: 70%; +} + +.shop-today a { + color: #007185; + text-decoration: none; + font-weight: bold; +} + +.cart-signin button { + background-color: #ff21bc; + border: 1px solid #a88734 #9c7e31 #846a29; + color: #fff; + padding: 10px 20px; + margin: 10px; + cursor: pointer; + border-radius: 3px; + justify-content: flex-end; /* Aligns content (button) to the right */ + padding: 10px; /* Optional padding for the container */ +} diff --git a/src/Components/cart/cart.js b/src/Components/cart/cart.js index f46d9c05..588ed8a4 100644 --- a/src/Components/cart/cart.js +++ b/src/Components/cart/cart.js @@ -1,128 +1,251 @@ -// src/components/ShoppingCart.js -import React, { useState, useEffect } from 'react'; +import React, { useState } from 'react'; +import { Link } from "react-router-dom"; +import homeIcon from '../../img/homeicon.png'; +import carticon from './12.png'; +import Card1 from "../../img/card1.jpg"; +import Card2 from "../../img/card2.jpg"; +import Card3 from "../../img/card3.jpg"; +import Card4 from "../../img/card4.jpg"; +import Card5 from "../../img/card5.jpg"; +import Card6 from "../../img/card6.jpg"; +import { useNavigate } from 'react-router-dom'; -const ShoppingCart = () => { - const [cartItems, setCartItems] = useState([]); - const [totalItems, setTotalItems] = useState(0); - const [totalPrice, setTotalPrice] = useState(0); +const Cart = () => { + const initialItems = [ + { id: 1, name: 'StockIT', price: 10, quantity: 0, image: Card1 }, + { id: 2, name: 'TakeNote', price: 12, quantity: 0, image: Card2 }, + { id: 3, name: 'TaRct', price: 21, quantity: 0, image: Card3 }, + { id: 4, name: 'To Do', price: 13, quantity: 0, image: Card4 }, + { id: 5, name: 'ArchiTect', price: 15, quantity: 0, image: Card5 }, + { id: 6, name: 'WeatherLy', price: 17, quantity: 0, image: Card6 }, + { id: 7, name: 'TypingTest', price: 11, quantity: 0, image: '/static/media/card7.b25b2be8caee889d6ad4.png' }, + { id: 8, name: 'Artisan', price: 18, quantity: 0, image: '/static/media/card8.5c7a98cedad9864c46b7.png' }, + { id: 9, name: 'BBlocks', price: 25, quantity: 0, image: '/static/media/card9.6d96022c8f0793e6dd91.png' }, + { id: 10, name: 'ZzShoes', price: 19, quantity: 0, image: '/static/media/card10.a53e1291e52ef0a4c11c.png' }, + { id: 11, name: 'SearchImage', price: 13, quantity: 0, image: '/static/media/card11.e2371ccc231824202cda.png' }, + { id: 12, name: 'Alimage', price: 20, quantity: 0, image: '/static/media/card12.093d95181352dfd0126b.png' }, + ]; - useEffect(() => { - const items = JSON.parse(localStorage.getItem('cartItems')) || []; - setCartItems(items); + const [cartItems, setCartItems] = useState(initialItems); + const [cartCount, setCartCount] = useState( + initialItems.reduce((total, item) => total + item.quantity, 0) + ); - let itemsCount = 0; - let priceTotal = 0; + const addToCart = (itemId) => { + setCartItems((prevItems) => + prevItems.map((item) => + item.id === itemId + ? { ...item, quantity: item.quantity + 1 } + : item + ) + ); + setCartCount(cartCount + 1); + }; - items.forEach(item => { - itemsCount += item.quantity; - priceTotal += item.price * item.quantity; - }); + const removeFromCart = (itemId) => { + const item = cartItems.find((item) => item.id === itemId); + if (item && item.quantity > 0) { + setCartItems((prevItems) => + prevItems.map((item) => + item.id === itemId + ? { ...item, quantity: item.quantity - 1 } + : item + ) + ); + setCartCount(cartCount - 1); + } + }; - setTotalItems(itemsCount); - setTotalPrice(priceTotal); - }, []); + const navigate = useNavigate(); - const checkout = () => { - alert('Proceeding to checkout...'); + const signIn = () => { + navigate('/login'); // Navigate to the login page + window.scrollTo(0, 0); + }; + + const signUp = () => { + navigate('/login'); // Navigate to the login page + window.scrollTo(0, 0); }; return ( -
{item.name}
-Quantity: {item.quantity}
-Price: ${item.price * item.quantity}
+{item.price}
+{item.quantity}
Total Items: {totalItems}
-Total Price: ${totalPrice.toFixed(2)}
- -Total Items:
-Total Price: $
- +