Skip to content

Commit

Permalink
Implemented Person component
Browse files Browse the repository at this point in the history
  • Loading branch information
jcv10 committed May 21, 2024
1 parent 42e3dea commit 587d270
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/Person/Person.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ export const Person = ({ person }) => {
let partnerName = 'I am not married';

if (person.isMarried) {
partnerName = `${person.partnerName} is my ${Person.sex === 'f' ? 'husband' : 'wife'}`;
partnerName = `${person.partnerName} is my ${person.sex === 'f' ? 'husband' : 'wife'}`;
}

const Age = () => {
const { age } = person;

if (age) {
return <p className="Person__age">I am {person.age}</p>;
}

return null;
};

return (
<section className="Person">
<h2 className="Person__name">My name is {person.name}</h2>
<p className="Person__age">I am {person.age}</p>
<Age />
<p className="Person__partner">{partnerName}</p>
</section>
);
Expand Down

0 comments on commit 587d270

Please sign in to comment.