-
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
Ecommerce development v1 #1
base: master
Are you sure you want to change the base?
Conversation
feat: show products add to cart and wishlist sort and filter by price and categories responsive design
<button className="btn btn-primary" onClick={() => navigate("/products")}> | ||
Shop Now | ||
</button> |
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.
Hey Ritika,
Its better if u wrap the btn inside Link
and navigate using that.
<Link to="/products"> <button className="btn btn-primary" >
Shop Now
</button></Link>
You can make similar changes in the Login/signup form
<button | ||
class="btn btn-link" | ||
onClick={() => navigate("/password/forgot")} | ||
> | ||
Forgot Password? | ||
</button> |
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.
Same as below comment for Link
on Shop now btn.
import { EmptyCart } from "./emptyCart"; | ||
|
||
export function Cart() { | ||
const { data } = useData(); |
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.
const { data } = useData(); | |
const { data: { cartList } } = useData(); |
we can destructure data object here for our ease.
<div className="container-inside margin-top container-flex-column"> | ||
<img className="img-md" src={emptyCartImage} alt="Empty cart"/> | ||
<h1 className="text-colored">Cart is empty!</h1> | ||
<button className="btn btn-primary" onClick={() => navigate("/products")}>Shop Now</button> |
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.
Here too, its better to use the Link
tag .
import "./nav-menu.css"; | ||
|
||
export function NavMenu() { | ||
const { data, dispatch } = useData(); |
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.
const { data, dispatch } = useData(); | |
const { data:{ navToggle }, dispatch } = useData(); |
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.
Hey Ritika, I've suggested some minor changes do check it out
<form className="form-box"> | ||
<h2 class="text-centre">Forgot Password</h2> | ||
<div className="input-field"> | ||
<input type="email" className="input-text" id="email" required /> |
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.
input can be nested inside label and written like
<label>Email:<input/></label>
So that the id can be avoided
|
||
.nav .nav-menu { | ||
position: absolute; | ||
height: cal(100vh - 100%); |
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.
its calc() not cal()
src/components/router/router.js
Outdated
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="products" element={<Products />} /> | ||
<Route path="login" element={<Login />} /> |
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.
A check can be added here so that a logged in user is not able to access /login
import logo from "../../assets/satik-logo.png"; | ||
|
||
export function Navigation() { | ||
const { data, dispatch } = useData(); |
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.
const { data, dispatch } = useData(); | |
const { data:{ navToggle,wishList,cartList }, dispatch } = useData(); |
return productList.sort((a, b) => a.price - b.price); | ||
else if (sortby === "SORT_PRICE_DESC") | ||
return productList.sort((a, b) => b.price - a.price); |
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.
This will mutate the original productList array. To check its effect, u can try doing a Clear Filter btn. Hence we should apply sort
on a new array. Here's a way we can do it:
[...productList].sort((a, b) => a.price - b.price);
Plz correct me if I am missing anything !
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.
Hi Ritika,
The folders are structured well. CSS is also cleanly written with good used of variables and classnames.
I have only made minor refactoring suggestions in the code.
Development 2 - Integration with backend
No description provided.