-
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 #1160
base: master
Are you sure you want to change the base?
Solution #1160
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.
you did good job and interesting solution ( I really like it :) )
but please fix some task requirements and make it perfect! 🚀
<NavLink | ||
aria-current="page" | ||
className="navbar-item has-background-grey-lighter" | ||
href="#/people" | ||
className={({ isActive }) => | ||
cn('navbar-item', isTabActive({ isActive })) | ||
} | ||
to="people" | ||
> | ||
People | ||
</a> | ||
</NavLink> |
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.
here you forgot to add this. make sure to do this here and in all People link in table
"Keep search params when navigating within the People page (when selecting a person or clicking the People link)."
src/components/PeopleFilters.tsx
Outdated
const query = searchParams.get('query') || ''; | ||
|
||
const handleQuery = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const params = new URLSearchParams(searchParams); | ||
|
||
params.set('query', event.target.value); | ||
setSearchParams(params); | ||
}; |
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.
you need to make sure, that if query is empty, it should be deleted from searchParams
src/components/PeopleFilters.tsx
Outdated
const handleGenderChange = ( | ||
gender: Sex, | ||
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>, | ||
) => { | ||
event.preventDefault(); | ||
const params = new URLSearchParams(searchParams); | ||
|
||
params.set('sex', gender); | ||
setSearchParams(params); | ||
}; |
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.
and for sex as well as for query - empty parameter should not be in search params
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 your implementation! 🎉 Your code meets the task requirements and constraints effectively. While there are a few minor issues related to routing and sorting logic, they don't significantly impact the overall functionality. Keep up the good work, and consider addressing these minor points to further enhance your code. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
case 'born': | ||
case 'died': | ||
const result3 = filteredPeople.sort((person1, person2) => { | ||
return person1.born - person2.born; |
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 sorting logic for 'born' and 'died' cases is currently identical, both sorting by 'born'. If you intend to sort by 'died' as well, you should adjust the logic to compare 'person1.died - person2.died' for the 'died' case.
@@ -32,9 +112,14 @@ export const PeopleTable = () => { | |||
<th> | |||
<span className="is-flex is-flex-wrap-nowrap"> | |||
Born | |||
<a href="#/people?sort=born&order=desc"> | |||
<a | |||
href="#/people?sort=born&order=desc" |
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 href
attribute in the 'Born' column header includes &order=desc
, which might not be necessary since the handleSortByCategory
function manages the order state. Consider removing it to avoid potential confusion.
<Route path="people" element={<PeoplePage />}> | ||
<Route path=":slug?" element={<PeoplePage />} /> |
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 nested route <Route path=":slug?" element={<PeoplePage />} />
inside the people
route might cause the PeoplePage
component to render twice when a slug
is present. Consider reviewing the routing logic to ensure the component is rendered as intended.
DEMO LINK