Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2bd29eb
commit 150830a
Showing
2 changed files
with
96 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,80 @@ | ||
|
||
import React, { Component } from 'react'; | ||
|
||
class ReadableGood extends Component { | ||
class Inventory extends Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
localCurrency: 'usd', | ||
inventory: [ | ||
{ | ||
product: 'Flashlight', | ||
img: '/flashlight.jpg', | ||
desc: 'A really great flashlight', | ||
price: 100, | ||
currency: 'usd', | ||
}, | ||
{ | ||
product: 'Tin can', | ||
img: '/tin_can.jpg', | ||
desc: 'Pretty much what you would expect from a tin can', | ||
price: 32, | ||
currency: 'usd', | ||
}, | ||
{ | ||
product: 'Cardboard Box', | ||
img: '/cardboard_box.png', | ||
desc: 'It holds things', | ||
price: 5, | ||
currency: 'usd', | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
Readable Good | ||
</div> | ||
<table style={{ width: '100%' }}> | ||
<tbody> | ||
<tr> | ||
<th> | ||
Product | ||
</th> | ||
|
||
<th> | ||
Image | ||
</th> | ||
|
||
<th> | ||
Description | ||
</th> | ||
|
||
<th> | ||
Price | ||
</th> | ||
</tr> | ||
{this.state.inventory.map((item, idx) => ( | ||
<tr key={idx}> | ||
<td> | ||
{item.product} | ||
</td> | ||
|
||
<td> | ||
<img src={item.img} alt="" /> | ||
</td> | ||
|
||
<td> | ||
{item.desc} | ||
</td> | ||
|
||
<td> | ||
{item.price} | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
} | ||
} | ||
|
||
export default ReadableGood; | ||
export default Inventory; |