From 4acafa4fcdba8e83f535f4dc428da013dcdadc3b Mon Sep 17 00:00:00 2001 From: DavidKuznets Date: Fri, 6 Dec 2024 15:56:10 +0200 Subject: [PATCH] Solution --- src/App.jsx | 30 ++++++++++-------------------- src/components/Person/Person.jsx | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index dcf8509c8..f419a8bf2 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', @@ -23,23 +24,12 @@ export const alex = { isMarried: false, }; -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

-
-
-); +export const App = () => { + return ( +
+ + + +
+ ); +}; diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx index eccf156a3..611105a05 100644 --- a/src/components/Person/Person.jsx +++ b/src/components/Person/Person.jsx @@ -1 +1,19 @@ -// export const Person = ({ person }) => (); +export const Person = ({ person }) => { + const { name, age, sex, isMarried, partnerName } = person; + + return ( +
+

My name is {name}

+ {age &&

I am {age}

} + {isMarried ? ( +

+ {sex === 'm' + ? `${partnerName} is my wife` + : `${partnerName} is my husband`} +

+ ) : ( +

I am not married

+ )} +
+ ); +};