Skip to content

Commit

Permalink
add small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Wita-Shchurko committed Dec 6, 2023
1 parent 89679fd commit 48fd0b6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/components/PersonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ type Props = {
};

export const PersonLink: React.FC<Props> = ({ person }) => {
const { people } = useContext(GlobalContext);
const { sortedPeople, searchParams } = useContext(GlobalContext);
const { user } = useParams();
const selectedUser = user;

const mother = people.find(human => human.name === person.motherName);
const father = people.find(human => human.name === person.fatherName);
const mother = sortedPeople.find(human => human.name === person.motherName);
const father = sortedPeople.find(human => human.name === person.fatherName);

return (
<tr
Expand All @@ -25,7 +25,10 @@ export const PersonLink: React.FC<Props> = ({ person }) => {
>
<td>
<Link
to={`/people/${person.slug}`}
to={{
pathname: `/people/${person.slug}`,
search: searchParams.toString(),
}}
className={classNames({
'has-text-danger': person.sex === 'f',
})}
Expand All @@ -42,7 +45,10 @@ export const PersonLink: React.FC<Props> = ({ person }) => {
&& mother
? (
<Link
to={`/people/${mother.slug}`}
to={{
pathname: `/people/${mother.slug}`,
search: searchParams.toString(),
}}
className={classNames({
'has-text-danger': mother.sex === 'f',
})}
Expand All @@ -60,7 +66,10 @@ export const PersonLink: React.FC<Props> = ({ person }) => {
&& father
? (
<Link
to={`/people/${father.slug}`}
to={{
pathname: `/people/${father.slug}`,
search: searchParams.toString(),
}}
>
{father.name}
</Link>
Expand Down

0 comments on commit 48fd0b6

Please sign in to comment.