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 #1065

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

add task solution #1065

wants to merge 3 commits into from

Conversation

siefimov
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.

Great work! 🔥

return (
<footer className="todoapp__footer" data-cy="Footer">
<span className="todo-count" data-cy="TodosCounter">
{`${activeTodoCount} ${activeTodoCount === 1 ? 'item' : 'items'} left`}

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 helper variable and use it here

Comment on lines 25 to 56
<a
href="#/"
className={classNames('filter__link', {
selected: filter === TodoFilter.All,
})}
data-cy="FilterLinkAll"
onClick={() => setFilter(TodoFilter.All)}
>
All
</a>

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

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

{todos.length > 0 && (
<button
type="button"
className={`todoapp__toggle-all ${todos.every(todo => todo.completed) ? 'active' : ''}`}

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 everywere

<div className="todoapp__content">
<Header />

{todos.length > 0 && (

Choose a reason for hiding this comment

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

Suggested change
{todos.length > 0 && (
{!!todos.length && (

return (
<div
data-cy="Todo"
className={classNames('todo', { completed: todo.completed })}

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.

2 participants