-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: master
Are you sure you want to change the base?
add task solution #1718
Conversation
There was a problem hiding this 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
src/components/footer.tsx
Outdated
<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> |
There was a problem hiding this comment.
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
There was a problem hiding this 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' : ''}`} |
There was a problem hiding this comment.
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
src/components/footer.tsx
Outdated
<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 |
There was a problem hiding this comment.
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
useEffect(() => { | ||
setTodoClear(todos.some(todo => todo.completed)); // Тепер відображається, коли є завершені todo | ||
}, [todos]); |
There was a problem hiding this comment.
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)
DEMO LINK