Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TheYodash
Copy link

@TheYodash TheYodash commented Sep 1, 2024

@TheYodash TheYodash changed the title submitting assignment Moayad Mohammed React Week 1 Sep 1, 2024
@crevulus crevulus self-assigned this Sep 11, 2024
Copy link

@crevulus crevulus left a 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;

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. 🟢

Copy link
Author

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";
Copy link

@crevulus crevulus Sep 11, 2024

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. 🟢

Copy link
Author

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>

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/ 🟠

Copy link
Author

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

}

.product-img{
width: 300px;

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? 🟠

Copy link
Author

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 }) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good component!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants