mirror of
https://github.com/10h30/fullstackopen.git
synced 2026-06-05 15:08:33 +09:00
Completed 2.1
This commit is contained in:
Generated
+23
-21943
File diff suppressed because it is too large
Load Diff
@@ -2,28 +2,36 @@ import React from 'react'
|
|||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const course = {
|
const course = {
|
||||||
|
id: 1,
|
||||||
name: 'Half Stack application development',
|
name: 'Half Stack application development',
|
||||||
parts: [
|
parts: [
|
||||||
{
|
{
|
||||||
name: 'Fundamentals of React',
|
name: 'Fundamentals of React',
|
||||||
exercises: 10
|
exercises: 10,
|
||||||
|
id: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Using props to pass data',
|
name: 'Using props to pass data',
|
||||||
exercises: 7
|
exercises: 7,
|
||||||
|
id: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'State of a component',
|
name: 'State of a component',
|
||||||
exercises: 14
|
exercises: 14,
|
||||||
|
id: 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return <Course course={course} />
|
||||||
|
}
|
||||||
|
|
||||||
|
const Course = ({course}) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Header course={course} />
|
<Header course={course} />
|
||||||
<Content part={course.parts} />
|
<Content part={course.parts} />
|
||||||
<Total part={course.parts} />
|
{/*<Total part={course.parts} >*/}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -35,11 +43,12 @@ const Header = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Content = (props) => {
|
const Content = (props) => {
|
||||||
|
//console.log(props)
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Part part={props.part[0]} />
|
{props.part.map(part =>
|
||||||
<Part part={props.part[1]} />
|
<Part key={part.id} part={part} />
|
||||||
<Part part={props.part[2]} />
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
@@ -51,10 +60,10 @@ const Part = (props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Total = (props) => {
|
/*const Total = (props) => {
|
||||||
return (
|
return (
|
||||||
<p>Number of exercises {props.part[0].exercises + props.part[1].exercises + props.part[2].exercises}</p>
|
<p>Number of exercises {props.part[0].exercises + props.part[1].exercises + props.part[2].exercises}</p>
|
||||||
)
|
)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
export default App
|
export default App
|
||||||
Generated
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user