From ca5630e864b5760a230dd0489d74863b43181e48 Mon Sep 17 00:00:00 2001 From: Mykhailo Oliinyk Date: Fri, 5 Jun 2026 18:40:38 +0300 Subject: [PATCH] Solution --- README.md | 2 +- src/App.jsx | 20 ++++---------------- src/App.scss | 17 ----------------- src/components/Person/Person.jsx | 16 +++++++++++++++- src/components/Person/Person.scss | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 src/components/Person/Person.scss diff --git a/README.md b/README.md index e2f56a37be..3a29898d90 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,4 @@ and use it 3 times inside the `App` instead of static markup. - Install Prettier Extension and use this [VSCode settings](https://mate-academy.github.io/fe-program/tools/vscode/settings.json) to enable format on save. - Implement a solution following the [React task guideline](https://github.com/mate-academy/react_task-guideline#react-tasks-guideline). - Open one more terminal and run tests with `npm test` to ensure your solution is correct. -- Replace `` with your Github username in the [DEMO LINK](https://.github.io/react_person/) and add it to the PR description. +- Replace `` with your Github username in the [DEMO LINK](https://azesmmisha.github.io/react_person/) and add it to the PR description. diff --git a/src/App.jsx b/src/App.jsx index dcf8509c84..eb67351283 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Person } from './components/Person/Person'; import './App.scss'; export const 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/App.scss b/src/App.scss index 223ec3872a..c17d529f41 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,20 +1,3 @@ iframe { display: none; } - -.Person { - width: fit-content; - margin-bottom: 16px; - padding: 8px; - border: 1px solid #000; - border-radius: 8px; - - &__name { - margin-top: 8px; - } - - &__age { - color: #00f; - font-weight: bold; - } -} diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx index eccf156a37..fb4a8b4c70 100644 --- a/src/components/Person/Person.jsx +++ b/src/components/Person/Person.jsx @@ -1 +1,15 @@ -// export const Person = ({ person }) => (); +import './Person.scss'; + +export const Person = ({ person }) => { + return ( +
+

{`My name is ${person.name}`}

+ {person.age &&

{`I am ${person.age}`}

} +

+ {person.isMarried + ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` + : 'I am not married'} +

+
+ ); +}; diff --git a/src/components/Person/Person.scss b/src/components/Person/Person.scss new file mode 100644 index 0000000000..295d862006 --- /dev/null +++ b/src/components/Person/Person.scss @@ -0,0 +1,16 @@ +.Person { + width: fit-content; + margin-bottom: 16px; + padding: 8px; + border: 1px solid #000; + border-radius: 8px; + + &__name { + margin-top: 8px; + } + + &__age { + color: #00f; + font-weight: bold; + } +}