-
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
task solution_v1 #1530
base: master
Are you sure you want to change the base?
task solution_v1 #1530
Conversation
All tests closed locally, but GitHub shows problems with lint and tests... |
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.
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!
src/App.tsx
Outdated
{todos.length !== 0 && ( | ||
<footer className="todoapp__footer" data-cy="Footer"> | ||
<span className="todo-count" data-cy="TodosCounter"> | ||
{`${activeTodos} items left`} | ||
</span> | ||
|
||
<nav className="filter" data-cy="Filter"> | ||
{Object.values(FilterOptions).map(option => ( | ||
<a | ||
key={option} | ||
href={`#/${option}`} | ||
className={classNames('filter__link', { | ||
selected: currentFilter === option, | ||
})} | ||
data-cy={`FilterLink${option}`} | ||
onClick={() => setCurrentFilter(option)} | ||
> | ||
{option} | ||
</a> | ||
))} | ||
</nav> | ||
|
||
<button | ||
type="button" | ||
className="todoapp__clear-completed" | ||
data-cy="ClearCompletedButton" | ||
onClick={() => handleClearCompleted()} | ||
disabled={todos.every(todo => !todo.completed) || loading} | ||
> | ||
Clear completed | ||
</button> |
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 this logic to the Footer
component
data-cy="statusSelect" | ||
onChange={element => setFilter(element.target.value)} | ||
> | ||
<option value={FilterOptions.All}>All</option> |
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.
Also use enum here
<option value={FilterOptions.All}>All</option> | |
<option value={FilterOptions.All}>{FilterOptions.All}</option> |
Finally, I found my mistake with double rendering!! |
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.
https://inesshtepa.github.io/react_todo-app-with-api/