Commit 7ed7c153 authored by Sumaiyya Burney's avatar Sumaiyya Burney

Fixes search results, delete from search is broken

parent a207c9dd
import React from "react"; import React from "react";
import { Container } from "react-bootstrap"; import ProductRow from "./ProductRow.jsx";
// import "./../styles/ProductGrid.css"; import { Table } from "react-bootstrap";
import ProductTable from "./ProductTable.jsx"; // import "./../styles/ProductTable.css";
export default class SearchResults extends React.Component{ export default class SearchResults extends React.Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.state = { this.state = {
results: this.props.history.location.state.results results: this.props.history.location.state.results
}
} }
}
render(){ render() {
return ( return (
<div> <div className="container flex-column d-flex justify-content-center">
<h1 id="title" className="text-center" >Search Results</h1> <h1 id="title" className="text-center" >Search Results</h1>
<Container id="prod-grid" className="mt-3"> {this.state.results.length > 0 ?
{this.state.results.length > 0 ? <Table>
<ProductTable productData={this.state.results}/> <thead>
: <p>Unable to find any matching products.</p> <tr>
} <th>SKU</th>
</Container> <th>Product Name</th>
</div> <th>Price</th>
); <th>Category</th>
} <th>Available Stock</th>
<th>Blocked Stock</th>
<th>Fulfilled Stock</th>
</tr>
</thead>
<tbody>
{this.state.results.map((product) => {
return (
<ProductRow key={product.sku} product={product} />
);
})}
</tbody>
</Table>
:
<p>Unable to find any matching products.</p>
}
</div>
);
}
} }
\ No newline at end of file
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