-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cart #5
base: Main
Are you sure you want to change the base?
Cart #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.cart-material-icons { | ||
font-size: 1.3rem; | ||
} | ||
|
||
/*-------------------------Checkout page(card)---------------*/ | ||
.cart-brand-text { | ||
width: 18rem; | ||
} | ||
|
||
.cart-img { | ||
width: 8em; | ||
height: 8em; | ||
margin-left: 1rem; | ||
} | ||
|
||
del { | ||
font-size: 0.875rem; | ||
} | ||
|
||
.cart-product { | ||
display: flex; | ||
} | ||
|
||
.cart-items { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
|
||
.cart-input-container { | ||
width: 5rem; | ||
padding: 0.5rem; | ||
} | ||
|
||
/* Chrome, Safari, Edge, Opera */ | ||
.cart-items-input::-webkit-outer-spin-button, | ||
.cart-items-input::-webkit-inner-spin-button { | ||
-webkit-appearance: none; | ||
margin: 0; | ||
} | ||
|
||
/* Firefox */ | ||
.cart-items-input[type="number"] { | ||
-moz-appearance: textfield; | ||
} | ||
|
||
.cart-checkout { | ||
width: 100%; | ||
padding: 1rem; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
import React, { useEffect } from "react"; | ||
import { CartProducts } from "../../context/CartProvider"; | ||
|
||
export function Cart() { | ||
const { products, removeFromCart, total } = | ||
CartProducts(); | ||
|
||
useEffect(() => {}); | ||
|
||
let totalDisplayscont = total - 165; | ||
return ( | ||
<> | ||
<div className="user-main-container flex-space-evenly-start"> | ||
<main className="product-container border-radius-normal box-shadow col-7"> | ||
<p className="wishlist-text padding-normal"> | ||
My Cart({products.length}) | ||
</p> | ||
{products.map((product) => { | ||
return ( | ||
<div | ||
className="wishlist-card-container" | ||
key={product.id} | ||
> | ||
<div className="card-container-horizontal flex"> | ||
<section className="cart-product flex-column-center"> | ||
<section className="flex-row-start"> | ||
<img | ||
className="imgcard cart-img" | ||
src={product.img} | ||
alt="" | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion : Give a value for alt attribute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I'll do the suggested changes Thank you Balaji for PR Review |
||
/> | ||
<button className="material-icons-text card-wishlist-icons buttonHoverShadow AvatarImage AvatarIcons flex-row-center icon-wishlist"> | ||
<i className="material-icons "> | ||
favorite | ||
</i> | ||
</button> | ||
</section> | ||
|
||
<section className="flex-row-center"> | ||
<div className="AvatarDomMainContainer"> | ||
<button className="form-signup-icons"> | ||
<i className="material-icons cart-material-icons AvatarImage box-shadow AvatarIcons flex-row-center"> | ||
remove | ||
</i> | ||
</button> | ||
</div> | ||
<span className="cart-input-container"> | ||
<input | ||
type="number" | ||
className="cart-items-input input-range-container" | ||
value={ | ||
product.quantity | ||
} | ||
/> | ||
</span> | ||
<div className="AvatarDomMainContainer"> | ||
<button className="form-signup-icons"> | ||
<i className="material-icons cart-material-icons AvatarImage box-shadow AvatarIcons flex-row-center"> | ||
add | ||
</i> | ||
</button> | ||
</div> | ||
</section> | ||
</section> | ||
<span className="card-text-container cart-brand-text"> | ||
<span className="card-description"> | ||
<h5>{product.name}</h5> | ||
<p> | ||
Lorem ipsum dolor sit | ||
amet consectetur | ||
adipisicing elit. | ||
</p> | ||
<span className="rating-container"></span> | ||
<h6> | ||
{product.category} | ||
</h6> | ||
</span> | ||
|
||
<span className="card-container-price-icons card-footer"> | ||
<span className="card-price"> | ||
<span> | ||
$ | ||
{ | ||
product.discountedPrice | ||
} | ||
</span> | ||
<del> | ||
${product.price} | ||
</del> | ||
</span> | ||
</span> | ||
</span> | ||
|
||
<span></span> | ||
<button | ||
className="delete-icon | ||
buttonHoverShadow card-wishlist-icons" | ||
onClick={(e) => | ||
removeFromCart(product) | ||
} | ||
> | ||
<i className="material-icons cart-material-icons"> | ||
delete | ||
</i> | ||
</button> | ||
</div> | ||
<hr /> | ||
</div> | ||
); | ||
})} | ||
</main> | ||
|
||
<nav className=" margin-normal-left border-radius-normal box-shadow col-4"> | ||
<p className="wishlist-text padding-normal"> | ||
Price Details | ||
</p> | ||
|
||
<section className="flex-column-start"> | ||
<section className="flex-space-between cart-checkout"> | ||
<h4>Price ({total.length})</h4> | ||
<span>${total}</span> | ||
</section> | ||
|
||
<section className="flex-space-between cart-checkout"> | ||
<h4>Discount</h4> | ||
<span>-$200</span> | ||
</section> | ||
|
||
<section className="flex-space-between cart-checkout"> | ||
<h4>Coupons for you</h4> | ||
<span>-$15</span> | ||
</section> | ||
|
||
<section className="flex-space-between cart-checkout"> | ||
<h4>Delivery Charges</h4> | ||
<span>$50</span> | ||
</section> | ||
</section> | ||
|
||
<section className="flex-space-between cart-checkout"> | ||
<h3>Total Amount</h3> | ||
<span>${totalDisplayscont}</span> | ||
</section> | ||
|
||
<h4 className="flex-space-between cart-checkout"> | ||
You will save $40 on this order | ||
</h4> | ||
|
||
<section className="flex-row-center padding-normal"> | ||
<button className="buy-btn ButtonDomContainer button-Shadow"> | ||
Place Order | ||
</button> | ||
</section> | ||
</nav> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default Cart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty useEffect? Not sure if you intend to use it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll will change it