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

https://tranquil-chimera-7fb2ff.netlify.app/ #17

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

Conversation

mustafadurmusNl
Copy link

No description provided.

@tlorent tlorent self-assigned this Sep 14, 2024
Copy link

@tlorent tlorent left a comment

Choose a reason for hiding this comment

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

Great work @mustafadurmusNl ! 👏 I do not have a lot to mention, a few comments in the PR. But I also noticed that your deployed version does not match completely with the example. This is what I found:

  1. When I click on a category, the whole page refreshes instead of just the list of categories. In the live example only the categories refresh, not the filters or the title of the page. Please see if you can fix that 💪
  2. Clicking on the same category should remove the filtering and all categories should be shown again. Please see if you can fix this by looking at the example 🙂

@@ -0,0 +1,49 @@
/* eslint-disable no-unused-vars */
Copy link

Choose a reason for hiding this comment

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

Why have you disabled this lint rule? 🙂

Comment on lines 14 to 25
const fetchCategories = async () => {
setLoading(true);
try {
const response = await fetch(categoryUrl);
const data = await response.json();
setCategories(data);
} catch (error) {
setError("Failed to fetch categories.");
} finally {
setLoading(false);
}
};
Copy link

Choose a reason for hiding this comment

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

Nice work! 👏

Comment on lines +34 to +35
if (loading) return <div>Loading...</div>;
if (error) return <div>{error}</div>;
Copy link

Choose a reason for hiding this comment

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

Good to have a loading and error state! 👏

{categories.map((category) => (
<div key={category}
className = {`category ${category === selectedCategory ? 'category-selected' : ''}`}>
<h3 onClick={() => handleCategoryChange(category)}>{category}</h3>
Copy link

Choose a reason for hiding this comment

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

⚒️

As mentioned in review of week 1, you can now only select a category if you click directly on the h3/title/text and not on the rest of the button. Please fix this so the category is also selected if you click on the entire button 🙂

<div className="categories">
{categories.map((category) => (
<div key={category}
className = {`category ${category === selectedCategory ? 'category-selected' : ''}`}>
Copy link

Choose a reason for hiding this comment

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

⚒️

Nice work with the conditional CSS! However, there should not be spaces between the attribute and the value.

Suggested change
className = {`category ${category === selectedCategory ? 'category-selected' : ''}`}>
className={`category ${category === selectedCategory ? 'category-selected' : ''}`}>

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