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 #1589

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

add task solution #1589

wants to merge 3 commits into from

Conversation

Wesses
Copy link

@Wesses Wesses commented Aug 21, 2023

Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

Some comments below

Comment on lines 7 to 17
if (sex === SEX_FEMALE) {
return (
<p className="Person__partner">{`${partnerName} is my husband`}</p>
);
}

if (sex === SEX_MALE) {
return (
<p className="Person__partner">{`${partnerName} is my wife`}</p>
);
}

Choose a reason for hiding this comment

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

Maybe we can simplify this. The only difference between these 2 returns is the partner wife or husband. So better to use ternary here

<section className="Person">
<h2 className="Person__name">{`My name is ${name}`}</h2>

{typeof age === 'number' && (

Choose a reason for hiding this comment

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

Suggested change
{typeof age === 'number' && (
{!!age && (

Copy link
Author

Choose a reason for hiding this comment

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

if age === 0 ?

Copy link

@polosanya polosanya left a comment

Choose a reason for hiding this comment

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

Good job!

Comment on lines +26 to +28
{ isMarried
? (<p className="Person__partner">{`${partnerName} is my ${getPartnerStatus(sex)}`}</p>)
: (<p className="Person__partner">I am not married</p>)

Choose a reason for hiding this comment

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

You can put this condition inside "Person__partner" element, as it's used in both cases

<section className="Person">
<h2 className="Person__name">{`My name is ${name}`}</h2>

{!!age && (

Choose a reason for hiding this comment

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

It's not critical, but would be great to check if the age is a positive number

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.

3 participants