
Responsive Product list and cart
Design comparison
Solution retrospective
I'm proud of the time it took to develop the app, as well as the organization I maintained throughout the process. I feel that everything went smoothly, and honestly, I wouldn't change anything this time around.
What challenges did you encounter, and how did you overcome them?I faced the challenge of updating the cart and quantities in real time. I knew about React Context, but I hadn't used it before. I learned the basics and implemented it to meet the challenge.
What specific areas of your project would you like help with?I would appreciate advice on TypeScript and help with keeping the code clean, readable, and scalable.
Community feedback
- @khatri2002Posted about 2 months ago
Hi @AmilkarAlan!
The developed solution looks great! Below are some suggestions for improvement:
1 Use of Button Element
You’ve used adiv
element to render the “Add to Cart” text and icon, and handled theonClick
event on thisdiv
itself. While this works functionally, abutton
element would be more appropriate since it is interactive and triggers an action on click.
Using abutton
ensures:- Better accessibility (keyboard navigation, screen readers, etc.).
- Semantic correctness, as buttons are meant for actions.
- Built-in browser styling and behavior, such as focus indicators and
disabled
states.
2 Modal Height Adjustment
Currently, the modal that appears when clicking the “Confirm Order” button has a fixed height of100%
, and a scroll is introduced when the content overflows, which is perfect!However, a problem arises when fewer items (e.g., just 1) are in the cart. The modal still takes up the full screen height, creating unnecessary empty space, which is not ideal.
- Instead of a fixed height, set
height: auto;
andmax-height: 100%;
- This ensures the modal adapts dynamically:
- Expands only as much as needed when fewer items are in the cart.
- Becomes scrollable when more items are added, preventing overflow issues.
The rest of the solution looks great! Keep up the fantastic work! 🚀
Marked as helpful1@AmilkarAlanPosted about 2 months agoHi @khatri2002! I really appreciate you taking the time to view and review my project. Your recommendations are very helpful for improving it, and I will implement them right away.
Thank you so much for your feedback! 😃
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord