-
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 #1519
base: master
Are you sure you want to change the base?
solution #1519
Conversation
svitlanak31
commented
Nov 18, 2024
- DEMO LINK
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 👍
Let's make your code better
src/components/Footer.tsx
Outdated
<a | ||
href="#/" | ||
className={`filter__link ${statusFilter === FilterStatus.All ? 'selected' : ''}`} | ||
data-cy="FilterLinkAll" | ||
onClick={() => setStatusFilter(FilterStatus.All)} // Використовуємо FilterStatus | ||
> | ||
All | ||
</a> | ||
|
||
<a | ||
href="#/active" | ||
className={`filter__link ${statusFilter === FilterStatus.Active ? 'selected' : ''}`} | ||
data-cy="FilterLinkActive" | ||
onClick={() => setStatusFilter(FilterStatus.Active)} // Використовуємо FilterStatus | ||
> | ||
Active | ||
</a> | ||
|
||
<a | ||
href="#/completed" | ||
className={`filter__link ${statusFilter === FilterStatus.Completed ? 'selected' : ''}`} | ||
data-cy="FilterLinkCompleted" | ||
onClick={() => setStatusFilter(FilterStatus.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 Object.values(your create enum)
and render these options with map()
method
src/components/Footer.tsx
Outdated
<nav className="filter" data-cy="Filter"> | ||
<a | ||
href="#/" | ||
className={`filter__link ${statusFilter === FilterStatus.All ? 'selected' : ''}`} |
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
href="#/" | ||
className={`filter__link ${statusFilter === FilterStatus.All ? 'selected' : ''}`} | ||
data-cy="FilterLinkAll" | ||
onClick={() => setStatusFilter(FilterStatus.All)} // Використовуємо FilterStatus |
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.
Remove comments
onClick={() => setStatusFilter(FilterStatus.All)} // Використовуємо FilterStatus | |
onClick={() => setStatusFilter(FilterStatus.All)} |
src/components/TodoItem.tsx
Outdated
type="checkbox" | ||
className="todo__status" | ||
checked={todo.completed} | ||
onChange={() => toggleTodoStatus()} |
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.
onChange={() => toggleTodoStatus()} | |
onChange={toggleTodoStatus} |
key={todo.id} | ||
> | ||
<label htmlFor={`todo-status-${todo.id}`} className="todo__status-label"> | ||
{''} |
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/components/TodoItem.tsx
Outdated
className="todo__title" | ||
onDoubleClick={() => setIsEditing(true)} | ||
> | ||
{todo.title} |
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 destructuring for todo