Skip to content

Conversation

@vlnach
Copy link

@vlnach vlnach commented Sep 24, 2025

@sarlam sarlam self-assigned this Sep 25, 2025
Copy link

@sarlam sarlam left a comment

Choose a reason for hiding this comment

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

Really well crafted! The way you separated the utils as well as the component will make it easier for you to iterate over this codebase and add features.

Comment on lines +19 to +24
<Category
items={categoryItems}
activeCategory={selectedCategory}
onItemClick={setSelectedCategory}
/>
<Product items={filteredProducts} />
Copy link

Choose a reason for hiding this comment

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

Well done on separating the rendering in different component, it makes your code easier to maintain in the long run and easier to read as well

Comment on lines +10 to +14
const [selectedCategory, setSelectedCategory] = useState("All");

const categoryItems = ["All", ...categories];

const filteredProducts = filterCategory(allProducts, selectedCategory);
Copy link

Choose a reason for hiding this comment

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

If you want to go one step further, you could ask yourself how you would change this code to have the categories being toggles, or even, have multiple filters selected at the same time

Comment on lines +48 to +52
.category-items.active {
background: #000000;
color: #fff;
border-color: #000000;
}
Copy link

Choose a reason for hiding this comment

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

It would be a plus to change those values to be able to see which category is the selected one

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