-
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
first try #605
base: master
Are you sure you want to change the base?
first try #605
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.
Great job! Everything works as expected
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.
Overall looks fine but need to add some changes
src/components/PeopleFilters.tsx
Outdated
<a className="is-active" href="#/people">All</a> | ||
<a className="" href="#/people?sex=m">Male</a> | ||
<a className="" href="#/people?sex=f">Female</a> | ||
<SearchLink |
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 could map the search links
src/components/PeopleFilters.tsx
Outdated
setSearchParams( | ||
getSearchWith( | ||
searchParams, | ||
(event.target.value.trim()) | ||
? { query: event.target.value.trim().toLocaleLowerCase() } | ||
: { query: null }, |
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.
Would be better to move the logic separately in a handle function
src/components/PeoplePage.tsx
Outdated
const [error, setError] = useState(false); | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
// const [people, setPeople] = useState(peopleFromServer); |
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.
Don't forget to remove commented out lines
src/components/PeoplePage.tsx
Outdated
|
||
// #region getVisiblePeople | ||
|
||
let visiblePeople = [...peopleFromServer]; |
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.
Should be used a separate function to filter and sort from line 45 to line 89 which will return a filtered array
src/components/PeoplePage.tsx
Outdated
<p>There are no people matching the current search criteria</p> | ||
|
||
<PeopleTable /> | ||
{(() => { |
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.
Immediately invoked function with switch case using directly in JSX decrease readability. It would be better to use conditional rendering here. It is much more simplify and readable
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.
Looks good to me, only one minor comment🔥
if (sort) { | ||
result.sort((a, b) => { | ||
switch (sort) { | ||
case 'name': |
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.
will be better create enum
for types and reuse
DEMO LINK