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

add task solution #1718

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

add task solution #1718

wants to merge 5 commits into from

Conversation

naz4ik
Copy link

@naz4ik naz4ik commented Feb 9, 2025

Copy link

@vadiimvooo vadiimvooo left a comment

Choose a reason for hiding this comment

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

Good job, but you have to pass all tests. Feel free to ask for help in fe_chat

Comment on lines 26 to 51
<a
href="#/"
className={`filter__link ${newFilter === 'All' ? 'selected' : ''} `}
data-cy="FilterLinkAll"
onClick={() => setNewFilter('All')}
>
All
</a>

<a
href="#/active"
className={`filter__link ${newFilter === 'Active' ? 'selected' : ''} `}
data-cy="FilterLinkActive"
onClick={() => setNewFilter('Active')}
>
Active
</a>

<a
href="#/completed"
className={`filter__link ${newFilter === 'Completed' ? 'selected' : ''} `}
data-cy="FilterLinkCompleted"
onClick={() => setNewFilter('Completed')}
>
Completed
</a>

Choose a reason for hiding this comment

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

Use enum to render the list

@naz4ik naz4ik requested a review from vadiimvooo February 10, 2025 15:16
Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

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

Almost done!
Let's make your code better

return (
<div
data-cy="ErrorNotification"
className={`notification is-danger is-light has-text-weight-normal ${errorMessage.length === 0 ? 'hidden' : ''}`}

Choose a reason for hiding this comment

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

Use the classnames library for add classes with condition, fix it everywhere

Comment on lines 22 to 50
<a
href="#/"
className={classNames('filter__link', {
selected: newFilter === Filter.All,
})}
data-cy="FilterLinkAll"
onClick={() => setNewFilter(Filter.All)}
>
All
</a>
<a
href="#/active"
className={classNames('filter__link', {
selected: newFilter === Filter.Active,
})}
data-cy="FilterLinkActive"
onClick={() => setNewFilter(Filter.Active)}
>
Active
</a>
<a
href="#/completed"
className={classNames('filter__link', {
selected: newFilter === Filter.Completed,
})}
data-cy="FilterLinkCompleted"
onClick={() => setNewFilter(Filter.Completed)}
>
Completed

Choose a reason for hiding this comment

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

Use Object.values(Filter) and render these options with map() method

Comment on lines +43 to +45
useEffect(() => {
setTodoClear(todos.some(todo => todo.completed)); // Тепер відображається, коли є завершені todo
}, [todos]);

Choose a reason for hiding this comment

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

it can be just a var

const hasCompletedTodo = todos.some(todo => todo.completed)

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

Successfully merging this pull request may close these issues.

4 participants