-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add task solution #1578
base: master
Are you sure you want to change the base?
Add task solution #1578
Conversation
src/App.jsx
Outdated
{/* <section className="Person"> | ||
<h2 className="Person__name">My name is Olya</h2> | ||
<p className="Person__partner">Maksym is my husband</p> | ||
</section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
src/components/Person/Person.jsx
Outdated
export const Person = ({ person }) => ( | ||
<section className="Person"> | ||
<h2 className="Person__name">{`My name is ${person.name}`}</h2> | ||
{person.age && <p className="Person__age">{`I am ${person.age}`}</p>} | ||
<p className="Person__partner"> | ||
{person.isMarried | ||
? (`${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}`) | ||
: (`I am not married`)} | ||
</p> | ||
</section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use destructuring + fix code style, add some spaces, put properties on the new line + get rid of ternary inside of ternary, create variable for it
fix demo link please |
src/components/Person/Person.jsx
Outdated
partnerName, | ||
sex, | ||
} = person; | ||
const partnerSex = sex === 'm' ? 'wife' : 'husband'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/components/Person/Person.jsx
Outdated
</h2> | ||
{age && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</h2> | |
{age && ( | |
</h2> | |
{Boolean(age) && ( |
src/components/Person/Person.jsx
Outdated
{age && ( | ||
<p className="Person__age"> | ||
{`I am ${age}`} | ||
</p> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{age && ( | |
<p className="Person__age"> | |
{`I am ${age}`} | |
</p> | |
)} | |
{age && ( | |
<p className="Person__age"> | |
{`I am ${age}`} | |
</p> | |
)} |
src/components/Person/Person.jsx
Outdated
{isMarried | ||
? (`${partnerName} is my ${partnerSex}`) | ||
: (`I am not married`)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{isMarried | |
? (`${partnerName} is my ${partnerSex}`) | |
: (`I am not married`)} | |
{isMarried | |
? `${partnerName} is my ${partnerSex}` | |
: 'I am not married' | |
} |
src/components/Person/Person.jsx
Outdated
partnerName, | ||
sex, | ||
} = person; | ||
const partnerSex = sex === 'm' ? 'wife' : 'husband'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const partnerSex = sex === 'm' ? 'wife' : 'husband'; | |
const parterMarriageStatus = sex === 'm' ? 'wife' : 'husband'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now! 👍
https://davinnchii.github.io/react_person/