exercise 1.5
This commit is contained in:
parent
bbcea9fd36
commit
08b2a6caac
|
@ -1,7 +1,7 @@
|
|||
const Header = (props) => {
|
||||
return (
|
||||
<h1>
|
||||
{props.course}
|
||||
{props.course.course}
|
||||
</h1>
|
||||
)
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ const Part = (props) => {
|
|||
const Content = (props) => {
|
||||
return (
|
||||
<>
|
||||
<Part part={props.parts[0]} />
|
||||
<Part part={props.parts[1]} />
|
||||
<Part part={props.parts[2]} />
|
||||
<Part part={props.course.parts[0]} />
|
||||
<Part part={props.course.parts[1]} />
|
||||
<Part part={props.course.parts[2]} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const Total = (props) => {
|
||||
const total = props.parts[0].exercises + props.parts[1].exercises + props.parts[2].exercises
|
||||
const total = props.course.parts[0].exercises + props.course.parts[1].exercises + props.course.parts[2].exercises
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
|
@ -39,7 +39,7 @@ const Total = (props) => {
|
|||
}
|
||||
|
||||
const App = () => {
|
||||
const course = 'Half Stack application development'
|
||||
const title = 'Half Stack application development'
|
||||
const part1 = {
|
||||
name: 'Fundamentals of React',
|
||||
exercises: 10
|
||||
|
@ -53,12 +53,16 @@ const App = () => {
|
|||
exercises: 14
|
||||
}
|
||||
const parts = [part1, part2, part3]
|
||||
const course = {
|
||||
course: title,
|
||||
parts: parts
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header course={course} />
|
||||
<Content parts={parts} />
|
||||
<Total parts={parts} />
|
||||
<Content course={course} />
|
||||
<Total course={course} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue