-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 #2760
base: master
Are you sure you want to change the base?
solution #2760
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.
Thank you for your hard work on this Todo application! 😊 While your implementation is solid and follows React best practices, there are a few critical issues that need to be addressed before we can approve the pull request:
-
Core Requirement Compliance: The task description specifies that the
x
button in theTodoFilter
should clear thequery
and reset the todos. Currently, thex
button clears thequery
, but it does not explicitly reset the todos. This is a core requirement that needs to be fulfilled. -
Checklist Compliance: The code does not use the
classnames
library for defining classes conditionally, which is a requirement from the checklist. This needs to be addressed to meet the task requirements.
Please address these issues to ensure the functionality aligns with the task requirements. Once these changes are made, your code will be in great shape! Keep up the great work, and feel free to reach out if you have any questions or need further assistance. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
/> | ||
<span className="icon is-left"> | ||
<i className="fas fa-magnifying-glass" /> | ||
</span> | ||
|
||
<span className="icon is-right" style={{ pointerEvents: 'all' }}> | ||
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */} | ||
<button data-cy="clearSearchButton" type="button" className="delete" /> | ||
{query.length && ( |
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.
Consider explicitly comparing query.length
to zero for clarity and to avoid potential issues with falsy values. For example, use query.length > 0
.
}; | ||
|
||
export const TodoModal: React.FC<Props> = ({ todo, closeModal }) => { | ||
const [user, setUser] = useState({} as User); |
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.
Consider providing a more meaningful default state for user
if possible, rather than casting an empty object to User
.
|
||
{' by '} | ||
|
||
<a href="mailto:[email protected]">Leanne Graham</a> | ||
<a href="mailto:[email protected]">{user.name}</a> |
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 email link is hardcoded. Consider using user.email
dynamically if available to ensure the email link corresponds to the fetched user.
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 job on implementing the core functionality of the Todo application! 🎉 The x
button in the TodoFilter
component now correctly clears the query
and resets the todos, which aligns with the task requirements. However, there are a few areas for improvement:
-
Utilize the
classnames
Library: The code currently does not use theclassnames
library for conditional class definitions, which is a requirement. This library can help manage class names more efficiently across components likeApp.tsx
,TodoList.tsx
, andTodoModal.tsx
. -
Reset Todos Logic: Ensure that the logic for resetting todos is consistently implemented when the
x
button is clicked in theTodoFilter
component.
These improvements will not only enhance the code quality but also ensure compliance with the task checklist. Keep up the great work and continue learning from these experiences! Your progress is commendable, and addressing these points will further strengthen your coding skills. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
<TodoFilter | ||
query={query} | ||
searchTodo={setQuery} | ||
handleFiltered={setFilterParam} | ||
/> |
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 TodoFilter
component should reset the todos when the x
button is clicked, as per the task requirements. Ensure that the x
button not only clears the query
but also resets the todos to their initial state.
onClick={() => { | ||
searchTodo(''); | ||
}} |
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 x
button should not only clear the query
but also reset the todos to their initial state. Ensure that the logic to reset the todos is implemented here, as this is a core requirement of the task.
@@ -15,15 +32,28 @@ export const TodoFilter = () => ( | |||
data-cy="searchInput" | |||
type="text" | |||
className="input" |
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.
Consider using the classnames
library to manage conditional class names for the input field, as required by the checklist. This will help in managing class names more efficiently.
<tr | ||
key={el.id} | ||
data-cy="todo" | ||
className={el.id === todo?.id ? 'has-background-info-light' : ''} |
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.
Consider using the classnames
library to manage conditional class names for the row highlighting. This will help in managing class names more efficiently and is a requirement for this task.
className={ | ||
el.completed ? ' has-text-success' : 'has-text-danger' | ||
} |
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.
Consider using the classnames
library to manage conditional class names for the text color based on the completion status. This will help in managing class names more efficiently and is a requirement for this task.
<strong className="has-text-success">Done</strong> | ||
) : ( | ||
<strong className="has-text-danger">Planned</strong> |
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.
Consider using the classnames
library to manage conditional class names for the text color based on the completion status. This will help in managing class names more efficiently and is a requirement for this task.
DEMO LINK