-
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
Develop #641
base: master
Are you sure you want to change the base?
Develop #641
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/components/PeoplePage.tsx
Outdated
case 'name': | ||
{ | ||
prepared.sort((a, b) => a.name.localeCompare(b.name)); | ||
break; | ||
} | ||
|
||
case 'sex': | ||
{ | ||
prepared.sort((a, b) => a.sex.localeCompare(b.sex)); | ||
break; | ||
} |
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.
case 'name': | |
{ | |
prepared.sort((a, b) => a.name.localeCompare(b.name)); | |
break; | |
} | |
case 'sex': | |
{ | |
prepared.sort((a, b) => a.sex.localeCompare(b.sex)); | |
break; | |
} | |
case 'name': | |
case 'sex': | |
{ | |
prepared.sort((a, b) => a[sort].localeCompare(b[sort])); | |
break; | |
} |
you can simplify it
src/components/PeoplePage.tsx
Outdated
case 'born': { | ||
prepared.sort((a, b) => a.born - b.born); | ||
break; | ||
} | ||
|
||
case 'died': { | ||
prepared.sort((a, b) => a.died - b.died); | ||
break; | ||
} |
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.
same here
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 overall! Left a few comments to make your code more advanced)
@@ -16,77 +53,58 @@ export const PeopleFilters = () => { | |||
type="search" | |||
className="input" | |||
placeholder="Search" | |||
value={query} | |||
onChange={e => handleSearch(e)} |
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.
onChange={e => handleSearch(e)} | |
onChange={handleSearch} |
<p data-cy="noPeopleMessage"> | ||
There are no people on the server | ||
</p> | ||
{(!isLoader && !errorMessage && !people.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 moving long ternaries to a separate const with consistent name and use the const here
DEMO LINK