Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add task solution #1578

wants to merge 4 commits into from

Conversation

davinnchii
Copy link

@davinnchii davinnchii commented Aug 21, 2023

src/App.jsx Outdated
Comment on lines 33 to 36
{/* <section className="Person">
<h2 className="Person__name">My name is Olya</h2>
<p className="Person__partner">Maksym is my husband</p>
</section>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Comment on lines 1 to 10
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>

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

@tiserett
Copy link

fix demo link please

partnerName,
sex,
} = person;
const partnerSex = sex === 'm' ? 'wife' : 'husband';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Comment on lines 15 to 16
</h2>
{age && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</h2>
{age && (
</h2>
{Boolean(age) && (

Comment on lines 16 to 20
{age && (
<p className="Person__age">
{`I am ${age}`}
</p>
)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 22 to 24
{isMarried
? (`${partnerName} is my ${partnerSex}`)
: (`I am not married`)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{isMarried
? (`${partnerName} is my ${partnerSex}`)
: (`I am not married`)}
{isMarried
? `${partnerName} is my ${partnerSex}`
: 'I am not married'
}

partnerName,
sex,
} = person;
const partnerSex = sex === 'm' ? 'wife' : 'husband';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const partnerSex = sex === 'm' ? 'wife' : 'husband';
const parterMarriageStatus = sex === 'm' ? 'wife' : 'husband';

Copy link

@alexander-ignatow alexander-ignatow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants