Skip to content

Commit

Permalink
add const for partner check
Browse files Browse the repository at this point in the history
  • Loading branch information
schyrva committed Nov 19, 2024
1 parent 1c1444c commit d72ca29
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/Person/Person.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
export const Person = ({ person }) => {
const { name, age, sex, isMarried, partnerName } = person;
const partnerSex =
sex === 'm' ? `${partnerName} is my wife` : `${partnerName} is my husband`;

return (
<section className="Person">
<h2 className="Person__name">My name is {name}</h2>
{age && <p className="Person__age">I am {age}</p>}
{isMarried ? (
<p className="Person__partner">
{partnerName} is my {sex === 'm' ? 'wife' : 'husband'}
</p>
) : (
<p className="Person__partner"> I am not married</p>
)}
<p className="Person__partner">
{isMarried ? partnerSex : 'I am not married'}
</p>
</section>
);
};

0 comments on commit d72ca29

Please sign in to comment.