From dc297bd03808475782651af9de296fe6d7309b62 Mon Sep 17 00:00:00 2001 From: Tetiana Date: Sat, 23 May 2026 15:02:20 +0200 Subject: [PATCH] solution --- src/App.jsx | 20 ++++---------------- src/components/Person/Person.jsx | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index dcf8509c84..c09fddf212 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,5 +1,6 @@ import React from 'react'; import './App.scss'; +import { Person } from './components/Person/Person'; export const misha = { name: 'Misha', @@ -25,21 +26,8 @@ export const alex = { export const App = () => (
-
-

My name is Misha

-

I am 37

-

Natasha is my wife

-
- -
-

My name is Olya

-

Maksym is my husband

-
- -
-

My name is Alex

-

I am 25

-

I am not married

-
+ + +
); diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx index eccf156a37..79ae9809fa 100644 --- a/src/components/Person/Person.jsx +++ b/src/components/Person/Person.jsx @@ -1 +1,23 @@ -// export const Person = ({ person }) => (); +export const Person = ({ person }) => { + let partnerText = ''; + + if (person.isMarried === false) { + partnerText = 'I am not married'; + } else if (person.sex === 'm') { + partnerText = `${person.partnerName} is my wife`; + } else { + partnerText = `${person.partnerName} is my husband`; + } + + return ( +
+

My name is {person.name}

+ + {person.age !== undefined && ( +

I am {person.age}

+ )} + +

{partnerText}

+
+ ); +};