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