-
Notifications
You must be signed in to change notification settings - Fork 8
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
Moayad Mohammed React Week 1 #2
base: main
Are you sure you want to change the base?
Moayad Mohammed React Week 1 #2
Conversation
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 Moayad,
Great work on this first React assignment. I see you have a good grasp of React, rendering UI, and components. These are the core things we want you to learn about this week. Well done.
My comments are mostly about your CSS and HTML. It's very important not to overlook these two things, as they are the core foundations for any frontend development. Mastering them will make you an even better React developer.
Please review my comments and make those changes.
} | ||
|
||
h1 { | ||
font-size: 3em; |
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.
In your css you use a combination of different units. rem
, em
, px
, vh
, etc. It's best not to use too many. I suggest you start by choosing between rem
and em
and sticking to just one of them. 🟢
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 have changed all of the fonts to rem to match it with the root element
@@ -0,0 +1,16 @@ | |||
import React from "react"; |
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.
The convention in React (and other frontend frameworks) is to name your component files in the same case as your component name - i.e. with a capital letter. Categories
, Products
, etc. 🟢
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.
noted!
{categories.map((category) => ( | ||
<div key={category} | ||
className = {`category ${category === selectedCategory ? 'category-selected' : ''}`}> | ||
<h3 onClick={() => handleCategoryClick(category)}>{category}</h3> |
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.
It's important to use semantic HTML. Buttons should use the button
element. https://www.freecodecamp.org/news/semantic-html-alternatives-to-using-divs/ 🟠
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.
replaced div with button element
week1/project/ecommerce/src/App.css
Outdated
} | ||
|
||
.product-img{ | ||
width: 300px; |
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.
You've set a fixed height and width on the images. But not all images are the same width and height. This cause the images to become warped and stretch. Can you find a solution that doesn't utilise a fixed width and height? 🟠
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.
edit the product image to the following:
width: 100%; height: auto; object-fit: contain;
and added flex
container for the container element
@@ -0,0 +1,18 @@ | |||
import React from "react"; | |||
|
|||
const Products = ({ products }) => { |
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.
Good component!
website link:
https://66e16c8e606808e33b8e61f5--resilient-daifuku-620acc.netlify.app/