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

solution #1519

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

solution #1519

wants to merge 2 commits into from

Conversation

svitlanak31
Copy link

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.

Good job 👍
Let's make your code better

Comment on lines 26 to 51
<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>

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

<nav className="filter" data-cy="Filter">
<a
href="#/"
className={`filter__link ${statusFilter === FilterStatus.All ? 'selected' : ''}`}

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

href="#/"
className={`filter__link ${statusFilter === FilterStatus.All ? 'selected' : ''}`}
data-cy="FilterLinkAll"
onClick={() => setStatusFilter(FilterStatus.All)} // Використовуємо FilterStatus

Choose a reason for hiding this comment

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

Remove comments

Suggested change
onClick={() => setStatusFilter(FilterStatus.All)} // Використовуємо FilterStatus
onClick={() => setStatusFilter(FilterStatus.All)}

type="checkbox"
className="todo__status"
checked={todo.completed}
onChange={() => toggleTodoStatus()}

Choose a reason for hiding this comment

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

Suggested change
onChange={() => toggleTodoStatus()}
onChange={toggleTodoStatus}

key={todo.id}
>
<label htmlFor={`todo-status-${todo.id}`} className="todo__status-label">
{''}

Choose a reason for hiding this comment

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

Suggested change
{''}

className="todo__title"
onDoubleClick={() => setIsEditing(true)}
>
{todo.title}

Choose a reason for hiding this comment

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

Use destructuring for todo

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.

3 participants