Skip to content

Commit 72c8d16

Browse files
committed
mapped books json & removed css files
1 parent b8cddae commit 72c8d16

File tree

11 files changed

+1133
-18
lines changed

11 files changed

+1133
-18
lines changed

package-lock.json

Lines changed: 797 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"bootstrap": "^4.3.1",
7+
"node-sass": "^4.12.0",
78
"react": "^16.10.2",
89
"react-bootstrap": "^1.0.0-beta.14",
910
"react-dom": "^16.10.2",

public/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
-->
1616
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1717

18+
<script src="../DIST/web3.min.js"></script>
19+
20+
1821
<link
1922
rel="stylesheet"
2023
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"

src/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
23
import "./App.css";
34
import { BrowserRouter } from "react-router-dom";
45

src/components/HomePage/BookList/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,30 @@ import React, { Component } from "react";
33
import BookListItem from "../BookListItem";
44
import { Table } from "react-bootstrap";
55

6-
export default class BookList extends Component {
6+
import books from "../books.json";
7+
8+
class BookList extends Component {
79
render() {
10+
console.log(books);
11+
12+
const Books = books.map(item => {
13+
return <BookListItem key={item.id} item={item} />;
14+
});
15+
816
return (
9-
<Table striped bordered hover>
17+
<Table striped bordered hover className="book-list-table">
1018
<thead>
1119
<tr>
1220
<th>#</th>
13-
<th>Book Name</th>
21+
<th>Book</th>
1422
<th>Author</th>
1523
<th>Price</th>
1624
</tr>
1725
</thead>
18-
<tbody>
19-
<BookListItem />
20-
</tbody>
26+
<tbody>{Books}</tbody>
2127
</Table>
2228
);
2329
}
2430
}
31+
32+
export default BookList;

src/components/HomePage/BookListItem/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ export default class BookListItem extends Component {
44
render() {
55
return (
66
<tr>
7-
<td>1</td>
8-
<td>Harry Potter</td>
9-
<td>Otto</td>
10-
<td>@mdo</td>
7+
<td>{this.props.item.id}</td>
8+
<td>{this.props.item.name}</td>
9+
<td>{this.props.item.author}</td>
10+
<td>{this.props.item.price}</td>
1111
</tr>
1212
);
1313
}

src/components/HomePage/books.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"id": 1,
4+
"name": "Harry Potter",
5+
"author": "J.K Rowling",
6+
"price": 15
7+
},
8+
{
9+
"id": 2,
10+
"name": "Angels and Demons",
11+
"author": "Dan Brown",
12+
"price": 19
13+
},
14+
{
15+
"id": 3,
16+
"name": "2 states",
17+
"author": "Chetan Bhagat",
18+
"price": 10
19+
},
20+
{
21+
"id": 4,
22+
"name": "Percy Jackson",
23+
"author": "Rick Riordan",
24+
"price": 28
25+
}
26+
]

src/components/HomePage/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class HomePage extends Component {
1010
<div className="nav-bar">
1111
<Navbar />
1212
</div>
13-
<div className="main-content container">
13+
<div className="main-content container" style={{ paddingTop: "40px" }}>
1414
<BookList />
1515
</div>
1616
</div>

src/components/HomePage/style.css

Whitespace-only changes.

src/components/Navbar/style.css

Whitespace-only changes.

0 commit comments

Comments
 (0)