Commit ac96a63a authored by Martin Fahl's avatar Martin Fahl

adds table

parent 0c6734e0
......@@ -2,6 +2,7 @@ import React, { Component, Fragment } from "react";
import PropTypes from "prop-types";
import { Filter } from "../../presentational/Filter/Filter";
import { Item } from "../Item/Item";
import { Table, Card, CardBody } from "mdbreact";
export class InventoryList extends Component {
constructor(props) {
......@@ -18,17 +19,29 @@ export class InventoryList extends Component {
render() {
return (
<Fragment>
<Filter
updateFilter={this.updateFilter}
filterTerm={this.state.filterTerm}
/>
{this.state.items
.filter(items => items.includes(this.state.filterTerm))
.map((name, index) => (
<Item key={index} name={name} />
))}
</Fragment>
<Card className="mt-4 mb-4">
<CardBody>
<Filter
updateFilter={this.updateFilter}
filterTerm={this.state.filterTerm}
/>
<Table small striped>
<thead>
<tr>
<th>Name</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
{this.state.items
.filter(items => items.includes(this.state.filterTerm))
.map((name, index) => (
<Item key={index} name={name} />
))}
</tbody>
</Table>
</CardBody>
</Card>
);
}
}
......
......@@ -20,9 +20,10 @@ export class Item extends Component {
render() {
return (
<div className="row">
{this.props.name}
</div>
<tr>
<td>{this.props.name}</td>
<td>{this.state.counter}</td>
</tr>
);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment