Skip to content
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
2 changes: 1 addition & 1 deletion project/src/components/Confirm/Confirm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const Confirm = () => {
key={product.id}
title={product.title}
desc={product.subtitle}
size={product.size}
size={product.size[3]}
itemNo={product.itemNo}
quantity={product.quantity}
price={product.price}
Expand Down
11 changes: 6 additions & 5 deletions project/src/components/ListChild.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SimpleGrid, Box, Grid, GridItem, Image } from "@chakra-ui/react";
import { SimpleGrid, Box, Grid, GridItem, Image, Heading, Text } from "@chakra-ui/react";
import React, { useState } from "react";

const ListChild = ({
Expand All @@ -10,6 +10,7 @@ const ListChild = ({
quant,
getData,
setProduct,
size
}) => {
// eslint-disable-next-line no-unused-vars
const [quantity, setQuantity] = useState(1);
Expand Down Expand Up @@ -77,11 +78,11 @@ const ListChild = ({
</GridItem>
<GridItem w="100%" h="auto">
<Box align="left" mt="6">
{title}
<Text fontWeight={"bold"} >{title}</Text>
</Box>
<Box align="left">{desc}</Box>
<Box align="left">
Size: <span>size</span>
Size: <span>{size[3]}</span>
</Box>
<Box align="left">
item no.: <span>{id}</span>{" "}
Expand All @@ -107,7 +108,7 @@ const ListChild = ({
${price}
</GridItem>
<button
style={{ backgroundColor: "rgb(240, 240, 240)" }}
style={{width:"2px", backgroundColor: "rgb(240, 240, 240)" }}
disabled={quant === 1}
onClick={() => handleDec(id)}
>
Expand All @@ -117,7 +118,7 @@ const ListChild = ({
{quant}
</GridItem>
<button
style={{ backgroundColor: "rgb(240, 240, 240)" }}
style={{width:"2px", backgroundColor: "rgb(240, 240, 240)" }}
onClick={() => handleInc(id)}
>
+
Expand Down
7 changes: 5 additions & 2 deletions project/src/components/ProductList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ const ProductList = () => {
const [product, setProduct] = useState([]);
const [flag, setFlag] = useState(false);
let total = 0;

let s=JSON.parse(localStorage.getItem("ElementSize"));
useEffect(() => {
setLoading(true);
s=JSON.parse(localStorage.getItem("ElementSize"))||{};
// console.log(s)
getData()
.then((res) => {
setLoading(false);
Expand Down Expand Up @@ -131,6 +133,7 @@ const ProductList = () => {
getData={getData}
setProduct={setProduct}
p={el.price}
size={el.size}
/>
<div className="checkoutDiv">
<Button
Expand Down Expand Up @@ -216,7 +219,7 @@ const ProductList = () => {
borderBottom={"1px solid gray"}
>
{product.map((el)=>{
console.log(total+=Number(el.price))
total+=Number(el.price)
})}
<Text fontWeight={"bold"} align={"right"}>
Total:- ${total}
Expand Down