-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
solution #879
base: master
Are you sure you want to change the base?
solution #879
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.
src/App.tsx
Outdated
if (updatedCompletedTodo.completed | ||
!== prevTodos.find((todo) => todo.id | ||
=== updatedCompletedTodo.id)?.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.
Move condition into variable - it's hard readable
src/components/Footer.tsx
Outdated
}, [todos]); | ||
|
||
return ( | ||
<footer className="todoapp__footer" data-cy="Footer"> | ||
<span className="todo-count" data-cy="TodosCounter"> | ||
{`${activeTodosCount} items left`} | ||
</span> | ||
|
||
<nav className="filter" data-cy="Filter"> | ||
<a | ||
href="#/" | ||
className={classNames('filter__link', { | ||
selected: filterBy === Filter.All, | ||
})} | ||
data-cy="FilterLinkAll" | ||
onClick={() => setFilterBy(Filter.All)} | ||
> | ||
All | ||
</a> | ||
|
||
<a | ||
href="#/active" | ||
className={classNames('filter__link', { | ||
selected: filterBy === Filter.Active, | ||
})} | ||
data-cy="FilterLinkActive" | ||
onClick={() => setFilterBy(Filter.Active)} | ||
> | ||
Active | ||
</a> | ||
|
||
<a | ||
href="#/completed" | ||
className={classNames('filter__link', { | ||
selected: filterBy === Filter.Completed, | ||
})} | ||
data-cy="FilterLinkCompleted" | ||
onClick={() => setFilterBy(Filter.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.
Better will do this way, instead of usign anonymous function
}, [todos]); | |
return ( | |
<footer className="todoapp__footer" data-cy="Footer"> | |
<span className="todo-count" data-cy="TodosCounter"> | |
{`${activeTodosCount} items left`} | |
</span> | |
<nav className="filter" data-cy="Filter"> | |
<a | |
href="#/" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.All, | |
})} | |
data-cy="FilterLinkAll" | |
onClick={() => setFilterBy(Filter.All)} | |
> | |
All | |
</a> | |
<a | |
href="#/active" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.Active, | |
})} | |
data-cy="FilterLinkActive" | |
onClick={() => setFilterBy(Filter.Active)} | |
> | |
Active | |
</a> | |
<a | |
href="#/completed" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.Completed, | |
})} | |
data-cy="FilterLinkCompleted" | |
onClick={() => setFilterBy(Filter.Completed)} | |
> | |
}, [todos]); | |
const onFilterSelect = (fillter: Filter) => () => { | |
setFilterBy(fillter); | |
} | |
return ( | |
<footer className="todoapp__footer" data-cy="Footer"> | |
<span className="todo-count" data-cy="TodosCounter"> | |
{`${activeTodosCount} items left`} | |
</span> | |
<nav className="filter" data-cy="Filter"> | |
<a | |
href="#/" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.All, | |
})} | |
data-cy="FilterLinkAll" | |
onClick={onFilterSelect(Filter.All)} | |
> | |
All | |
</a> | |
<a | |
href="#/active" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.Active, | |
})} | |
data-cy="FilterLinkActive" | |
onClick={onFilterSelect(Filter.Active)} | |
> | |
Active | |
</a> | |
<a | |
href="#/completed" | |
className={classNames('filter__link', { | |
selected: filterBy === Filter.Completed, | |
})} | |
data-cy="FilterLinkCompleted" | |
onClick={onFilterSelect(Filter.Completed)} | |
> |
src/components/TodoItem.tsx
Outdated
onSubmit={(e) => { | ||
e.preventDefault(); | ||
handleEditSubmit(); | ||
}} |
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.
move e.preventDefault();
into handleEditSubmit
handler
onSubmit={(e) => { | |
e.preventDefault(); | |
handleEditSubmit(); | |
}} | |
onSubmit={handleEditSubmit} |
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.
A lot of tests are failed.
Please try to fix them.
For example hide error message in 3 seconds.
In general tests describes what behavior they are expecting.
DEMO LINK