Skip to content

Commit

Permalink
task sollution
Browse files Browse the repository at this point in the history
  • Loading branch information
lanalightmj committed Dec 16, 2024
1 parent 7b51afd commit 772e3b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
36 changes: 20 additions & 16 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import './App.scss';

import { Person } from './components/Person/Person';

export const misha = {
name: 'Misha',
age: 37,
Expand All @@ -25,21 +27,23 @@ export const alex = {

export const App = () => (
<div className="App">
<section className="Person">
<h2 className="Person__name">My name is Misha</h2>
<p className="Person__age">I am 37</p>
<p className="Person__partner">Natasha is my wife</p>
</section>

<section className="Person">
<h2 className="Person__name">My name is Olya</h2>
<p className="Person__partner">Maksym is my husband</p>
</section>

<section className="Person">
<h2 className="Person__name">My name is Alex</h2>
<p className="Person__age">I am 25</p>
<p className="Person__partner">I am not married</p>
</section>
<Person
person={{
name: 'Misha',
age: 37,
sex: 'm',
isMarried: true,
partnerName: 'Natasha',
}}
/>
<Person
person={{
name: 'Olya',
sex: 'f',
isMarried: true,
partnerName: 'Maksym',
}}
/>
<Person person={{ name: 'Alex', age: 25, sex: 'm', isMarried: false }} />
</div>
);
20 changes: 19 additions & 1 deletion src/components/Person/Person.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
// export const Person = ({ person }) => ();
export const Person = ({ person }) => (
<section className="Person">
<h2 className="Person__name">{`My name is ${person.name}`}</h2>
<p className="Person__age">
{person.age ? <p>I am ${person.age}</p> : null}
</p>
{person.isMarried === true ? (
<p className="Person__partner">
{person.sex === 'm' ? (
<p>${person.partnerName} is my wife</p>
) : (
<p>${person.partnerName} is my husband</p>
)}
</p>
) : (
<p>I am not married</p>
)}
</section>
);

0 comments on commit 772e3b2

Please sign in to comment.