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

task solution #610

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

Conversation

YePolishchuk
Copy link

Copy link

@vlevik vlevik left a comment

Choose a reason for hiding this comment

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

good job! :)

Copy link

@superpooperxxx superpooperxxx left a comment

Choose a reason for hiding this comment

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

Nice try🔥

Comment on lines +28 to +46
let visiblePeople = [...people];

if (sex) {
visiblePeople = visiblePeople.filter(person => person.sex === sex);
}

if (centuries.length) {
visiblePeople = visiblePeople
.filter(person => centuries
.includes(Math.ceil(person.born / 100).toString()));
}

if (query) {
visiblePeople = visiblePeople.filter(person => (
person.name.toLowerCase().includes(query)
|| person.motherName?.toLowerCase().includes(query)
|| person.fatherName?.toLowerCase().includes(query)
));
}

Choose a reason for hiding this comment

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

Let's put filtration into separate function and store it in separate file

Comment on lines +31 to +48
<SearchLink
params={{ sex: null }}
className={cn({ 'is-active': !sex })}
>
All
</SearchLink>
<SearchLink
params={{ sex: 'm' }}
className={cn({ 'is-active': sex === 'm' })}
>
Male
</SearchLink>
<SearchLink
params={{ sex: 'f' }}
className={cn({ 'is-active': sex === 'f' })}
>
Female
</SearchLink>

Choose a reason for hiding this comment

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

Let'a render as a list

className="button is-link is-outlined is-fullwidth"
href="#/people"
params={{ sex: null, query: null, centuries: null }}

Choose a reason for hiding this comment

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

Let's find a way to reset ALL filters together (not setting null to each of them separately)

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.

3 participants