-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #1053
base: master
Are you sure you want to change the base?
solution #1053
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.
Well done! A few small comments
|
||
export const TodoList: React.FC = () => { | ||
return ( | ||
<> | ||
<p className="notification is-warning"> |
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/TodoList/TodoList.tsx
Outdated
{filteredTodos.map(todo => { | ||
return ( |
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.
{filteredTodos.map(todo => { | |
return ( | |
{filteredTodos.map(todo => { | |
const { completed, id, title } = todo; | |
return ( |
src/components/TodoList/TodoList.tsx
Outdated
'has-text-danger': todo.completed === false, | ||
'has-text-success': todo.completed === true, |
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.
'has-text-danger': todo.completed === false, | |
'has-text-success': todo.completed === true, | |
'has-text-danger': !todo.completed, | |
'has-text-success': todo.completed, |
package.json
Outdated
"@mate-academy/students-ts-config": "*", | ||
"@mate-academy/stylelint-config": "*", | ||
"@types/node": "^20.14.10", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"@types/react-redux": "^7.1.33", | ||
"@types/react-transition-group": "^4.4.10", | ||
"@typescript-eslint/eslint-plugin": "^8.8.0", |
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.
My solution was to clone the repo into a new folder and reinstall the dependencies. Thanks!
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!
src/components/TodoList/TodoList.tsx
Outdated
const { completed, id, title } = todo; | ||
|
||
return ( | ||
<tr | ||
data-cy="todo" | ||
className={classnames({ | ||
'has-background-info-light': selectedTodo, | ||
})} | ||
key={id} | ||
> | ||
<td className="is-vcentered">{id}</td> | ||
<td className="is-vcentered"> | ||
{completed && ( | ||
<span className="icon" data-cy="iconCompleted"> | ||
<i className="fas fa-check" /> | ||
</span> | ||
)} | ||
</td> | ||
<td className="is-vcentered is-expanded"> | ||
<p | ||
className={classnames({ | ||
'has-text-danger': !completed, | ||
'has-text-success': completed, | ||
})} | ||
> | ||
{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.
Move this logic to the TodoItem
component
src/utils/filter.ts
Outdated
case 'active': | ||
filteredTodos = todos.filter(todo => !todo.completed); | ||
break; | ||
|
||
case '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.
Create a enum for 'all', 'active', 'completed' and use 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.
Great work! 🔥
DEMO LINK