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

add task solution #1086

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

Conversation

BohdanDymydiuk
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 improve your code

Comment on lines 12 to 13
// #endregion
// #region handlers

Choose a reason for hiding this comment

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

Remove all comments

Suggested change
// #endregion
// #region handlers

Comment on lines 38 to 69
<a
href="#/"
className={classNames('filter__link', {
selected: filter === Filter.all,
})}
data-cy="FilterLinkAll"
onClick={() => setFilter(Filter.all)}
>
{Filter.all}
</a>

<a
href="#/active"
className={classNames('filter__link', {
selected: filter === Filter.active,
})}
data-cy="FilterLinkActive"
onClick={() => setFilter(Filter.active)}
>
{Filter.active}
</a>

<a
href="#/completed"
className={classNames('filter__link', {
selected: filter === Filter.completed,
})}
data-cy="FilterLinkCompleted"
onClick={() => setFilter(Filter.completed)}
>
{Filter.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(Filter) and render these options with map() method

Comment on lines 97 to 124
<div
key={id}
data-cy="Todo"
className={classNames('todo', { completed: isTodoChecked })}
>
<label className="todo__status-label">
<input
data-cy="TodoStatus"
type="checkbox"
className="todo__status"
onChange={() => toogleHandler(id)}
checked={isTodoChecked}
/>
</label>

{editableTodoById === id ? (
<form onSubmit={event => onSubmit(event, id)}>
<input
ref={todoInputRef}
onBlur={event => onSubmit(event, id)}
data-cy="TodoTitleField"
type="text"
className="todo__title-field"
placeholder="Empty todo will be deleted"
value={editableTitle}
onChange={event => setEditableTitle(event.target.value)}
/>
</form>

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 TodoItem component

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! 👍

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.

2 participants