From cdfbbdb3ae622faed7f1d628461b24a742ee0a51 Mon Sep 17 00:00:00 2001
From: Yaroslav Halynskyi <125606535+Yaroslav65@users.noreply.github.com>
Date: Sun, 19 May 2024 22:27:01 +0200
Subject: [PATCH 1/4] react_person
---
src/App.jsx | 20 ++++----------------
src/App.scss | 17 -----------------
src/components/Person/Person.jsx | 28 +++++++++++++++++++++++++++-
src/components/Person/Person.scss | 16 ++++++++++++++++
4 files changed, 47 insertions(+), 34 deletions(-)
create mode 100644 src/components/Person/Person.scss
diff --git a/src/App.jsx b/src/App.jsx
index dcf8509c8..c09fddf21 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/App.scss b/src/App.scss
index 223ec3872..c17d529f4 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 eccf156a3..66b61fa11 100644
--- a/src/components/Person/Person.jsx
+++ b/src/components/Person/Person.jsx
@@ -1 +1,27 @@
-// export const Person = ({ person }) => ();
+import './Person.scss';
+
+const Married = ({ person }) => {
+ if (person.isMarried === false) {
+ return I am not married
;
+ }
+
+ if (person.sex === 'f') {
+ return {person.partnerName} is my husband
;
+ }
+
+ return {person.partnerName} is my wife
;
+};
+
+export const Person = ({ person }) => (
+
+ {`My name is ${person.name}`}
+ {person.age !== undefined ? (
+
+
{`I am ${person.age}`}
+
+ ) : null}
+
+
+
+
+);
diff --git a/src/components/Person/Person.scss b/src/components/Person/Person.scss
new file mode 100644
index 000000000..295d86200
--- /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;
+ }
+}
From 100f198f0edd13e38e060bfb237a1733e770f5b1 Mon Sep 17 00:00:00 2001
From: Yaroslav Halynskyi <125606535+Yaroslav65@users.noreply.github.com>
Date: Mon, 20 May 2024 17:58:15 +0200
Subject: [PATCH 2/4] fix errors
---
src/components/Person/Person.jsx | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx
index 66b61fa11..e1c1cc480 100644
--- a/src/components/Person/Person.jsx
+++ b/src/components/Person/Person.jsx
@@ -1,27 +1,21 @@
import './Person.scss';
-const Married = ({ person }) => {
- if (person.isMarried === false) {
- return I am not married
;
- }
-
- if (person.sex === 'f') {
- return {person.partnerName} is my husband
;
- }
-
- return {person.partnerName} is my wife
;
-};
-
export const Person = ({ person }) => (
{`My name is ${person.name}`}
- {person.age !== undefined ? (
+ {person.age && (
{`I am ${person.age}`}
- ) : null}
+ )}
-
+ {person.isMarried === false ? (
+
I am not married
+ ) : person.sex === 'f' ? (
+ {person.partnerName} is my husband
+ ) : (
+ {person.partnerName} is my wife
+ )}
);
From 32fdc647cb557fd3a96470c9f37ed2f6a4221711 Mon Sep 17 00:00:00 2001
From: Yaroslav Halynskyi <125606535+Yaroslav65@users.noreply.github.com>
Date: Mon, 20 May 2024 18:57:58 +0200
Subject: [PATCH 3/4] fix
---
src/components/Person/Person.jsx | 41 ++++++++++++++++++--------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx
index e1c1cc480..200484f0d 100644
--- a/src/components/Person/Person.jsx
+++ b/src/components/Person/Person.jsx
@@ -1,21 +1,26 @@
import './Person.scss';
-export const Person = ({ person }) => (
-
- {`My name is ${person.name}`}
- {person.age && (
-
-
{`I am ${person.age}`}
-
- )}
-
- {person.isMarried === false ? (
-
I am not married
- ) : person.sex === 'f' ? (
- {person.partnerName} is my husband
- ) : (
- {person.partnerName} is my wife
+export const Person = ({ person }) => {
+ const partner = person.sex === 'm' ? 'wife' : 'husband';
+
+ return (
+
+ {`My name is ${person.name}`}
+ {person.age && (
+
+
{`I am ${person.age}`}
+
)}
-
-
-);
+
+
+ {person.isMarried === false ? (
+
I am not married
+ ) : (
+
+ {person.partnerName} is my {partner}
+
+ )}
+
+
+ );
+};
From 7ec76d6553a56569b2c99ceb1b7ac538c4c3dd07 Mon Sep 17 00:00:00 2001
From: Yaroslav Halynskyi <125606535+Yaroslav65@users.noreply.github.com>
Date: Mon, 20 May 2024 19:13:15 +0200
Subject: [PATCH 4/4] fixing errors
---
src/components/Person/Person.jsx | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/components/Person/Person.jsx b/src/components/Person/Person.jsx
index 200484f0d..6702a8644 100644
--- a/src/components/Person/Person.jsx
+++ b/src/components/Person/Person.jsx
@@ -13,13 +13,9 @@ export const Person = ({ person }) => {
)}
- {person.isMarried === false ? (
-
I am not married
- ) : (
-
- {person.partnerName} is my {partner}
-
- )}
+ {person.isMarried === false
+ ? 'I am not married'
+ : `${person.partnerName} is my ${partner}`}
);