-
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
Develop #1579
base: master
Are you sure you want to change the base?
Develop #1579
Conversation
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/App.tsx
Outdated
setChangeTodoId(todoItem.id); | ||
}; | ||
|
||
const ClearCompleted = () => { |
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.
const ClearCompleted = () => { | |
const clearCompleted = () => { |
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.
The edit mode looks strange, you need to fix styles - не знаю як це зробити, підскажіть будь-ласка, витратив купу часу і так і не зрозумів, чому стилі не спрацьовують
src/App.tsx
Outdated
<header className="todoapp__header"> | ||
<button | ||
type="button" | ||
// className="todoapp__toggle-all active" |
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 all comments
// className="todoapp__toggle-all active" |
src/App.tsx
Outdated
<button | ||
type="button" | ||
// className="todoapp__toggle-all active" | ||
className={`todoapp__toggle-all ${allCompleted ? 'active' : ''}`} |
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
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!
Let's make your code better
src/App.tsx
Outdated
.then(todosList => { | ||
setTodos(todosList); | ||
}) |
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.
.then(todosList => { | |
setTodos(todosList); | |
}) | |
.then(setTodos) |
src/componens/ErrorMessage.tsx
Outdated
return ( | ||
<div | ||
data-cy="ErrorNotification" | ||
className={`notification is-danger is-light has-text-weight-normal ${errorMessage ? '' : 'hidden'}`} |
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/componens/Footer.tsx
Outdated
return ( | ||
<footer className="todoapp__footer" data-cy="Footer"> | ||
<span className="todo-count" data-cy="TodosCounter"> | ||
{todos.filter(tod => !tod.completed).length} items left |
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 from jsx to the helper variable and use it here
src/componens/Footer.tsx
Outdated
<a | ||
href="#/" | ||
className={classNames('filter__link', { | ||
selected: filter === FilterType.All, | ||
})} | ||
data-cy="FilterLinkAll" | ||
onClick={() => setFilter(FilterType.All)} | ||
> | ||
All | ||
</a> | ||
|
||
<a | ||
href="#/active" | ||
className={classNames('filter__link', { | ||
selected: filter === FilterType.Active, | ||
})} | ||
data-cy="FilterLinkActive" | ||
onClick={() => setFilter(FilterType.Active)} | ||
> | ||
Active | ||
</a> | ||
|
||
<a | ||
href="#/completed" | ||
className={classNames('filter__link', { | ||
selected: filter === FilterType.Completed, | ||
})} | ||
data-cy="FilterLinkCompleted" | ||
onClick={() => setFilter(FilterType.Completed)} |
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 created enum)
and render these options with map()
method
src/componens/Header.tsx
Outdated
}) => { | ||
const inputRef = useRef<HTMLInputElement | null>(null); | ||
const allCompleted = todos.every(tod => tod.completed); | ||
const ToggleAllButton = () => { |
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.
const ToggleAllButton = () => { | |
const toggleAllButton = () => { |
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/componens/TodoItem.tsx
Outdated
{isLoadingIds.includes(todoItem.id) && ( | ||
<div data-cy="TodoLoader" className="modal overlay is-active"> | ||
<div className="modal-background has-background-white-ter" /> | ||
<div className="loader" /> | ||
</div> | ||
)} |
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.
{isLoadingIds.includes(todoItem.id) && ( | |
<div data-cy="TodoLoader" className="modal overlay is-active"> | |
<div className="modal-background has-background-white-ter" /> | |
<div className="loader" /> | |
</div> | |
)} | |
<div | |
data-cy="TodoLoader" | |
className={cn('modal overlay', { 'is-active': isLoadingIds.includes(todoItem.id)})} | |
> | |
<div className="modal-background has-background-white-ter" /> | |
<div className="loader" /> | |
</div> |
src/componens/Footer.tsx
Outdated
|
||
|
||
|
||
|
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 empty spaces
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
const [todo, setTodo] = useState<string>(''); | ||
const [errorMessage, setErrorMessage] = useState<string>(''); |
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.
it's redundant to specify types for primitives
DEMO LINK