Skip to content

Ahmad_Zetouny-w1-React #5

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

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

Conversation

Zetouny
Copy link

@Zetouny Zetouny commented Jun 16, 2025

@crevulus crevulus self-assigned this Jun 19, 2025
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 Ahmad,

Great work - your app works well and your code is of a high quality. I have left some comments for you to fix. Make sure you don't commit code that throws errors in the console!

}

.categories-tabs li:hover {
background-color: #6279b8;

Choose a reason for hiding this comment

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

Good attention to detail to have hover and active colouring, but you might want to make them separate colours so that the user can easily distinguish between the two states. 🔵

.categories-tabs li {
width: 100%;
flex-grow: 1;
padding: 0.7em 2em;

Choose a reason for hiding this comment

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

You switch between several unit strategies here. You use both em and rem for dynamic units. I suggest you pick one and stick with it for better maintainability. 🔵

const categoriesList = categories.map((category) => {
const filterName = category.slice(6);
return (
<li

Choose a reason for hiding this comment

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

These should be buttons, not list items. You can put the buttons inside list items, but the element the user clicks should be a button. https://benmyers.dev/blog/clickable-divs/ 🟠

));

return (
<>

Choose a reason for hiding this comment

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

You don't need this empty fragment <> - it's not serving any purpose 🔵

border-radius: 5px;
}

.product img {

Choose a reason for hiding this comment

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

Instead of targeting the html elements within a class, you should simply set a class on the element you want to target. This will do a couple of things: 1. It will make it clearer which targets you're applying styles to, 2. It will increase the specificity of your styles. 🟠

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the advice. But in this case, should I keep the classes nested, or should it be seperated from the parent?

.product .product-image{}

OR

.product {}
.product-image{}

Choose a reason for hiding this comment

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

up to you! I usually separate them. It depends what you want to do with your styles. Do you want to a) target all product-image classes inside product classes, or target all product-image classes in the whole app? At this early stage they probably have the same result, but try thinking about the long term.

const filterName = category.slice(6);
return (
<li
className={filter === filterName ? "active-tab" : ""}

Choose a reason for hiding this comment

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

There is an error in your console here! 🔴

@Zetouny
Copy link
Author

Zetouny commented Jun 22, 2025

Thank you Chris for checking out my code.
Everything you mentioned makes 100% sense.

I've updated the app:
https://react-week1-ahmad-zetouny.netlify.app/

Please let me know if everything is correct so I can move to the 2nd week's assignment.

Thanks again.

@crevulus
Copy link

@Zetouny just so you know, you don't have to wait to correct my feedback before you move on to week 2. You can correct them ask you go forwards with the weekly assignments.

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