├── src
├── App.css
├── assets
│ ├── banner.jpg
│ ├── logo.png
│ ├── favicon.png
│ ├── pistal.png1
│ ├── category img
│ │ ├── mensshoes.jpg
│ │ ├── mensclothing.jpg
│ │ └── mensaccessories.jpg
│ └── Productimages
│ │ ├── casualshoe.jpg
│ │ ├── formalshoe.jpg
│ │ ├── menssandal.jpg
│ │ ├── tshirts
│ │ ├── redtshirt.png
│ │ ├── blacktshirt.jpg
│ │ └── whitetshirt.png
│ │ └── accessories
│ │ ├── bluewatch.jpg
│ │ ├── redwatch.jpg
│ │ └── leatherbelt.jpg
├── index.css
├── Pages
│ ├── Home.jsx
│ ├── Products.jsx
│ ├── Login.jsx
│ ├── Cart.jsx
│ └── Signup.jsx
├── main.jsx
├── App.jsx
├── Components
│ ├── BannerFooter.jsx
│ ├── Navbar.jsx
│ ├── Banner.jsx
│ ├── Categories.jsx
│ ├── Footer.jsx
│ └── Item.jsx
└── Context
│ ├── CartContext.jsx
│ └── Productdata.js
├── README.md
├── .gitattributes
├── postcss.config.js
├── vite.config.js
├── .gitignore
├── .eslintrc.cjs
├── tailwind.config.js
├── index.html
├── package.json
└── public
└── vite.svg
/src/App.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Project
2 | React Project Ecommerce Store
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/src/assets/banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/banner.jpg
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/favicon.png
--------------------------------------------------------------------------------
/src/assets/pistal.png1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/pistal.png1
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/src/assets/category img/mensshoes.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/category img/mensshoes.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/casualshoe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/casualshoe.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/formalshoe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/formalshoe.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/menssandal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/menssandal.jpg
--------------------------------------------------------------------------------
/src/assets/category img/mensclothing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/category img/mensclothing.jpg
--------------------------------------------------------------------------------
/src/assets/category img/mensaccessories.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/category img/mensaccessories.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/tshirts/redtshirt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/tshirts/redtshirt.png
--------------------------------------------------------------------------------
/src/assets/Productimages/tshirts/blacktshirt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/tshirts/blacktshirt.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/tshirts/whitetshirt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/tshirts/whitetshirt.png
--------------------------------------------------------------------------------
/src/assets/Productimages/accessories/bluewatch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/accessories/bluewatch.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/accessories/redwatch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/accessories/redwatch.jpg
--------------------------------------------------------------------------------
/src/assets/Productimages/accessories/leatherbelt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syproo/React-Project/HEAD/src/assets/Productimages/accessories/leatherbelt.jpg
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700;900&display=swap');
2 |
3 | @tailwind base;
4 | @tailwind components;
5 | @tailwind utilities;
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/src/Pages/Home.jsx:
--------------------------------------------------------------------------------
1 | import { Banner } from "../Components/Banner";
2 | import { BannerFooter } from "../Components/BannerFooter";
3 | import { Footer } from "../Components/Footer";
4 | import { Categories } from "../Components/Categories";
5 |
6 |
7 | export const Home = () => {
8 | return (
9 | <>
10 |
11 |
12 |
13 |
14 |
15 | >
16 | );
17 | };
18 |
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: { browser: true, es2020: true },
3 | extends: [
4 | 'eslint:recommended',
5 | 'plugin:react/recommended',
6 | 'plugin:react/jsx-runtime',
7 | 'plugin:react-hooks/recommended',
8 | ],
9 | parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
10 | settings: { react: { version: '18.2' } },
11 | plugins: ['react-refresh'],
12 | rules: {
13 | 'react-refresh/only-export-components': 'warn',
14 | },
15 | }
16 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | export default {
3 | content: [
4 | "./index.html",
5 | "./src/**/*.{js,ts,jsx,tsx}",
6 | "./node_modules/tw-elements/dist/js/**/*.js"
7 | ],
8 | theme: {
9 | extend: {},
10 |
11 |
12 |
13 | fontFamily:{
14 | font:["Poppins", "sans-serif"]
15 | }
16 | },
17 | // eslint-disable-next-line no-undef
18 | plugins: [require("tw-elements/dist/plugin.cjs")],
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom/client";
3 | import App from "./App.jsx";
4 | import "./index.css";
5 | import { CartProvider } from "./Context/CartContext.jsx";
6 | import { BrowserRouter } from "react-router-dom";
7 |
8 | ReactDOM.createRoot(document.getElementById("root")).render(
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 | Mercari:Your Marketplace
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Pages/Products.jsx:
--------------------------------------------------------------------------------
1 | import { Item } from "../Components/Item";
2 | import productData from "../Context/Productdata";
3 | import { useCart } from "../Context/CartContext";
4 | import { Footer } from "../Components/Footer";
5 |
6 | export const Products = () => {
7 | const { products } = productData;
8 | const { addToCart } = useCart();
9 |
10 | return (
11 | <>
12 |
13 |
14 | {products.map((product) => (
15 | - addToCart(product)}
19 | />
20 | ))}
21 |
22 |
23 |
24 |
25 | >
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/src/App.jsx:
--------------------------------------------------------------------------------
1 | import "./App.css";
2 | import { Cart } from "./Pages/Cart";
3 | import { Home } from "./Pages/Home";
4 | import { Login } from "./Pages/Login";
5 | import { Products } from "./Pages/Products";
6 | import { Signup } from "./Pages/Signup";
7 | import { Routes, Route } from "react-router-dom";
8 | import { Navbar } from "./Components/Navbar";
9 | import { useCart } from "./Context/CartContext";
10 |
11 | function App() {
12 | const { cartItemCount } = useCart();
13 |
14 | return (
15 | <>
16 |
17 |
18 | } />
19 | } />
20 | } />
21 | } />
22 | } />
23 |
24 | >
25 | );
26 | }
27 |
28 | export default App;
29 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-project",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "react": "^18.2.0",
14 | "react-dom": "^18.2.0",
15 | "react-icons": "^4.10.1",
16 | "react-router-dom": "^6.14.1",
17 | "tw-elements": "^1.0.0-beta2"
18 | },
19 | "devDependencies": {
20 | "@types/react": "^18.0.37",
21 | "@types/react-dom": "^18.0.11",
22 | "@vitejs/plugin-react": "^4.0.0",
23 | "autoprefixer": "^10.4.14",
24 | "eslint": "^8.38.0",
25 | "eslint-plugin-react": "^7.32.2",
26 | "eslint-plugin-react-hooks": "^4.6.0",
27 | "eslint-plugin-react-refresh": "^0.3.4",
28 | "postcss": "^8.4.25",
29 | "tailwindcss": "^3.3.2",
30 | "vite": "^4.3.9"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Components/BannerFooter.jsx:
--------------------------------------------------------------------------------
1 | export const BannerFooter = () => {
2 | return (
3 |
4 |
5 |
6 |
Buy & sell almost anything
7 |
8 | Shop and sell new, like-new, and preowned items.
9 |
10 | SIGN UP
11 |
12 |
13 |
Goodbye clutter
14 |
15 | Earn extra cash by selling unwanted gifts and items.
16 |
17 | LIST AN ITEM
18 |
19 |
20 |
Save up to 70% off retail
21 |
22 | Get access to exclusive promos & flash deals.
23 |
24 | SHOP DEALS
25 |
26 |
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/src/Components/Navbar.jsx:
--------------------------------------------------------------------------------
1 | import { BsBell, BsCart3 } from "react-icons/bs";
2 | import { NavLink } from "react-router-dom";
3 | import logo from "../assets/logo.png";
4 |
5 | // eslint-disable-next-line react/prop-types
6 | export const Navbar = ({ cartItemCount }) => {
7 | return (
8 | <>
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Sign up
19 |
20 |
21 |
22 |
23 | Log in
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {cartItemCount > 0 && (
35 |
36 | {cartItemCount < 9 ? cartItemCount : "9 +"}
37 |
38 | )}
39 |
40 |
41 | List an item
42 |
43 |
44 |
45 |
46 | >
47 | );
48 | };
49 |
--------------------------------------------------------------------------------
/src/Context/CartContext.jsx:
--------------------------------------------------------------------------------
1 | import { createContext, useContext, useState } from "react";
2 |
3 | const initialState = {
4 | cart: [],
5 | cartItemCount: () => 0,
6 | addToCart: () => null,
7 | removeFromCart: () => null,
8 | increaseQuantity: () => null,
9 | decreaseQuantity: () => null,
10 | };
11 |
12 | const CartContext = createContext(initialState);
13 |
14 | const useCart = () => useContext(CartContext);
15 |
16 | // eslint-disable-next-line react/prop-types
17 | const CartProvider = ({children}) => {
18 | const [cart, setCart] = useState(initialState.cart);
19 |
20 | const cartItemCount = () => {
21 | return cart.reduce((acc, item) => acc + item.quantity, 0)
22 | };
23 |
24 | const addToCart = (product) => {
25 | const productIdx = cart.findIndex((item) => item.product.id === product.id)
26 | if (productIdx ===! -1) {
27 | increaseQuantity(product.id)
28 | } else {
29 | setCart([...cart, { product, quantity: 1 }])
30 | }
31 | }
32 |
33 | const removeFromCart = (productId) => {
34 | setCart(cart.filter((item) => item.product.id !== productId))
35 | }
36 |
37 | const increaseQuantity = (productId) => {
38 | const copy = cart.slice()
39 | const productIdx = copy.findIndex((item) => item.product.id === productId)
40 | if (productIdx !== -1) {
41 | copy[productIdx].quantity += 1;
42 | setCart(copy)
43 | }
44 | }
45 |
46 | const decreaseQuantity = (productId) => {
47 | const copy = cart.slice()
48 | const productIdx = copy.findIndex((item) => item.product.id === productId)
49 | if (productIdx !== -1 && copy[productIdx].quantity > 1) {
50 | copy[productIdx].quantity -= 1
51 | setCart(copy)
52 | }
53 | }
54 |
55 | return (
56 |
66 | {children}
67 |
68 | );
69 | };
70 |
71 | // eslint-disable-next-line react-refresh/only-export-components
72 | export { useCart, CartProvider }
73 |
--------------------------------------------------------------------------------
/src/Context/Productdata.js:
--------------------------------------------------------------------------------
1 | const data = {
2 | products: [
3 | {
4 | id: "1",
5 | name: "Casual Shoes",
6 | img: "https://cdn.pixabay.com/photo/2018/09/30/21/29/sneakers-3714730_1280.jpg",
7 | price: 4990,
8 | category: "shoes"
9 | },
10 | {
11 | id: "2",
12 | name: "Formal Shoes",
13 | img: "https://cdn.pixabay.com/photo/2016/09/21/12/18/wingtip-1684696_1280.jpg",
14 | price: 5999,
15 | category: "shoes"
16 | },
17 | {
18 | id: "3",
19 | name: "Sandal",
20 | img: "https://img.freepik.com/free-photo/man-two-background-accessory-velcro_1203-6465.jpg?w=996&t=st=1690208179~exp=1690208779~hmac=2f0929b44ad950b5db5baf5bb61ce5134a5d0424671b885f26fc734bf234efc6",
21 | price: 2999,
22 | category: "shoes"
23 | },
24 | {
25 | id: "4",
26 | name: "White T-Shirt",
27 | img: "https://cdn.pixabay.com/photo/2016/03/25/09/04/t-shirt-1278404_1280.jpg",
28 | price: 1199,
29 | category: "Tshirt"
30 | },
31 | {
32 | id: "5",
33 | name: "Blue T-Shirt",
34 | img: "https://cdn.pixabay.com/photo/2017/05/23/10/53/t-shirt-design-2336850_1280.jpg",
35 | price: 1299,
36 | category: "Tshirt"
37 | },
38 | {
39 | id: "6",
40 | name: "Red T-Shirt",
41 | img: "https://cdn.pixabay.com/photo/2016/10/02/22/17/red-t-shirt-1710578_1280.jpg",
42 | price: 1150,
43 | category: "Tshirt"
44 | },
45 | {
46 | id: "7",
47 | name: "Red Watch",
48 | img: "https://cdn.pixabay.com/photo/2015/09/09/20/44/accessories-933231_1280.jpg",
49 | price: 1850,
50 | category: "Tshirt"
51 | },
52 | {
53 | id: "8",
54 | name: "Blue Watch",
55 | img: "https://cdn.pixabay.com/photo/2015/09/09/20/27/accessory-933123_1280.jpg",
56 | price: 1499,
57 | category: "Tshirt"
58 | },
59 | {
60 | id: "9",
61 | name: "Leather Belt",
62 | img: "https://cdn.pixabay.com/photo/2015/09/23/03/07/menswear-952835_1280.jpg",
63 | price: 1150,
64 | category: "Tshirt"
65 | },
66 |
67 | ]
68 | };
69 |
70 | export default data;
--------------------------------------------------------------------------------
/src/Components/Banner.jsx:
--------------------------------------------------------------------------------
1 | import { NavLink } from "react-router-dom";
2 | import Bannerimg from "../assets/banner.jpg";
3 | export const Banner = () => {
4 | return (
5 |
6 |
7 |
8 |
13 |
14 |
15 |
16 | Preowned is the
17 |
18 |
19 | new this year
20 |
21 |
27 |
28 |
29 |
30 | Mens Shoes
31 |
32 |
33 | Mens Clothing
34 |
35 |
36 | Mens Accessories
37 |
38 |
39 |
40 |
41 |
42 |
43 | );
44 | };
45 |
--------------------------------------------------------------------------------
/src/Components/Categories.jsx:
--------------------------------------------------------------------------------
1 | import { NavLink } from "react-router-dom";
2 | import mensshoes from "../assets/category img/mensshoes.jpg";
3 | import mensclothing from "../assets/category img/mensclothing.jpg";
4 | import mensaccessories from "../assets/category img/mensaccessories.jpg";
5 |
6 | export const Categories = () => {
7 | return (
8 |
9 |
10 |
11 | Product Category
12 |
13 |
14 |
15 |
16 |
21 |
22 |
23 | Mens Shoes
24 |
25 |
26 | Browse More
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
39 | Mens Clothing
40 |
41 |
42 | Browse More
43 |
44 |
45 |
46 |
47 |
48 |
53 |
54 |
55 | Accessories
56 |
57 |
58 | Browse More
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | );
67 | };
68 |
--------------------------------------------------------------------------------
/src/Components/Footer.jsx:
--------------------------------------------------------------------------------
1 | import { BsFacebook, BsInstagram, BsTwitter, BsWhatsapp } from "react-icons/bs";
2 | export const Footer = () => {
3 | return (
4 |
5 |
6 | {/* Footer links */}
7 |
8 |
9 | Explore
10 |
11 |
28 |
29 |
30 | {/* Footer links */}
31 |
51 |
52 | {/* Social links */}
53 |
54 |
55 | Connect
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | {/* Newsletter subscription */}
76 |
77 |
78 | Subscribe
79 |
80 |
81 | Subscribe to our newsletter to get the latest updates.
82 |
83 |
96 |
97 |
98 |
99 |
Copyrights@ Developed By Coding Wizards
100 |
101 |
102 | );
103 | };
104 |
--------------------------------------------------------------------------------
/src/Components/Item.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import { BsCartPlus } from "react-icons/bs";
3 |
4 | // eslint-disable-next-line react/prop-types
5 | export const Item = ({ data, addToCart }) => {
6 | const [modal, setModal] = useState(false);
7 | const closeModal = () => {
8 | setModal();
9 | };
10 | // eslint-disable-next-line react/prop-types
11 | const { id, img, name, price } = data;
12 |
13 | return (
14 | <>
15 |
16 |
17 |
18 |
{
20 | setModal(true);
21 | }}
22 | className="object-fit w-96 h-80 rounded-lg transition duration-500 ease-in-out hover:scale-105"
23 | src={img}
24 | alt=""
25 | />
26 |
27 |
{name}
28 |
29 | Rs : {price}
30 |
31 |
32 |
45 |
46 | {
48 | setModal(true);
49 | }}
50 | >
51 | Product Description....
52 |
53 |
54 |
55 |
56 |
57 |
58 | {/*Modal Code*/}
59 |
60 | {modal && (
61 |
62 |
63 | Product Description
64 |
65 |
66 |
67 |
72 |
73 |
74 |
{name}
75 |
76 |
77 |
78 |
79 | Description :
80 |
81 |
82 | In publishing and graphic design,
83 | Lorem ipsum is a placeholder text commonly used to
84 | demonstrate the
85 |
86 |
87 |
88 | Rs : {price}
89 |
90 |
91 |
closeModal(false)}
93 | className="text-sm lg:text-lg rounded-xl p-2 border-2 border-white text-white bg-gray-800 hover:bg-yellow-400 hover:text-black focus:outline-none focus:ring focus:ring-black"
94 | >
95 | Back To Products
96 |
97 |
101 |
102 | Add to Cart{" "}
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | )}
112 | >
113 | );
114 | };
115 |
--------------------------------------------------------------------------------
/src/Pages/Login.jsx:
--------------------------------------------------------------------------------
1 | export const Login = () => {
2 | return (
3 | <>
4 |
5 |
6 |
7 | Log in
8 |
9 |
43 |
46 |
47 |
51 |
56 |
57 |
58 |
59 |
60 |
65 |
66 |
67 |
68 |
69 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | {" "}
81 | Don't have an account?{" "}
82 |
83 | Sign up
84 |
85 |
86 |
87 |
88 | >
89 | );
90 | };
91 |
--------------------------------------------------------------------------------
/src/Pages/Cart.jsx:
--------------------------------------------------------------------------------
1 | import { Link } from "react-router-dom";
2 | import { useCart } from "../Context/CartContext";
3 | import { BsTrash3Fill } from "react-icons/bs";
4 |
5 | const ShippingCharges = 750;
6 | export const Cart = () => {
7 | const { cart, removeFromCart, increaseQuantity, decreaseQuantity } =
8 | useCart();
9 |
10 | const cartTotal = () => {
11 | return cart.reduce(
12 | (acc, item) => acc + item.product.price * item.quantity,
13 | 0
14 | );
15 | };
16 |
17 | const round = (value, decimals) => {
18 | return Number(Math.round(value + "e" + decimals) + "e-" + decimals);
19 | };
20 |
21 | return (
22 |
23 |
24 | {cart.length >= 1 ? (
25 |
26 |
27 |
Order Summary
28 | {cart.map((item) => (
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | {item.product.name}
38 |
39 |
40 |
41 | Rs- {round(item.product.price * item.quantity, 2)}.00
42 |
43 | {/*
Remove
*/}
44 |
45 |
46 |
47 |
48 | increaseQuantity(item.product.id)}
50 | className="text-lg rounded-lg p-2 border text-white bg-green-500 hover:bg-green-400 hover:text-black focus:outline-none focus:ring focus:ring-gray-800"
51 | >
52 | +
53 |
54 |
55 | {item.quantity}
56 |
57 | decreaseQuantity(item.product.id)}
59 | className="text-lg rounded-lg p-2 cursor-pointer border text-white bg-red-500 hover:bg-red-400 hover:text-black focus:outline-none focus:ring focus:ring-gray-800"
60 | >
61 | -
62 |
63 |
64 |
65 |
removeFromCart(item.product.id)}
68 | >
69 |
70 |
71 |
72 |
73 |
74 | ))}
75 |
76 |
77 |
78 | Payment Summary{" "}
79 |
80 |
81 |
82 | Subtotal:
83 | Rs- {round(cartTotal(), 2)}.00
84 |
85 |
86 | Shipping Charges:
87 | Rs- {ShippingCharges}.00
88 |
89 |
90 | Total Amount :
91 |
92 | Rs- {round(cartTotal() + ShippingCharges, 2)}.00
93 |
94 |
95 |
96 |
97 |
98 | ) : (
99 |
100 |
101 |
ⓘYour Cart is empty
102 |
103 |
104 |
105 |
106 | Back To Shopping{" "}
107 |
108 |
109 |
110 |
111 | )}
112 |
113 |
114 | );
115 | };
116 |
--------------------------------------------------------------------------------
/src/Pages/Signup.jsx:
--------------------------------------------------------------------------------
1 | import { NavLink } from "react-router-dom";
2 |
3 | export const Signup = () => {
4 | return (
5 | <>
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
84 |
92 |
97 |
98 |
103 |
108 |
109 |
110 | Login with Google
111 |
112 |
117 |
122 |
123 |
124 | Login with GitHub
125 |
126 |
127 |
128 |
129 |
130 | >
131 | );
132 | };
133 |
--------------------------------------------------------------------------------