Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Develop #641

wants to merge 4 commits into from

Conversation

KolomietsN
Copy link

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that you forgot to use this arrow for desc sorting
image

Comment on lines 67 to 77
case 'name':
{
prepared.sort((a, b) => a.name.localeCompare(b.name));
break;
}

case 'sex':
{
prepared.sort((a, b) => a.sex.localeCompare(b.sex));
break;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines 79 to 87
case 'born': {
prepared.sort((a, b) => a.born - b.born);
break;
}

case 'died': {
prepared.sort((a, b) => a.died - b.died);
break;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@KolomietsN KolomietsN requested a review from etojeDenys December 7, 2023 09:51
Copy link

@lerastarynets lerastarynets left a 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)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange={e => handleSearch(e)}
onChange={handleSearch}

<p data-cy="noPeopleMessage">
There are no people on the server
</p>
{(!isLoader && !errorMessage && !people.length) && (

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants