Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleh0293 committed Aug 22, 2023
1 parent 7c11a17 commit 6f95746
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/Person/Person.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import './Person.scss';

export const Person = ({ person }) => {
const { name,
const {
name,
age,
sex,
isMarried,
partnerName } = person;
const partnerDesignation = sex === 'm'
const partner = sex === 'm'
? 'wife'
: 'husband';

return (
<section className="Person">
<h2 className="Person__name">{`My name is ${name}`}</h2>
{person.age && (<p className="Person__age">{`I am ${age}`}</p>)}
<h2 className="Person__name">
{`My name is ${name}`}
</h2>

{person.age && (
<p className="Person__age">
{`I am ${age}`}
</p>
)}

<p className="Person__partner">
{ isMarried
? `${partnerName} is my ${partnerDesignation}`
? `${partnerName} is my ${partner}`
: 'I am not married'
}
</p>
Expand Down

0 comments on commit 6f95746

Please sign in to comment.