refine search
Former-commit-id: 0c98d8332b5cd756d60de41bfe3e6183258def78
This commit is contained in:
@@ -135,7 +135,7 @@ class BasketPopout extends Component {
|
|||||||
const item = this.state.items[key];
|
const item = this.state.items[key];
|
||||||
return /* html */`
|
return /* html */`
|
||||||
<div class="popup-content-item">
|
<div class="popup-content-item">
|
||||||
<span class="popup-content-item-quantity">X${item.quantity}</span>
|
<span class="popup-content-item-quantity">x${item.quantity}</span>
|
||||||
<super-compact-listing-component class="sc-listing"
|
<super-compact-listing-component class="sc-listing"
|
||||||
id="${key.split('~')[0]}"
|
id="${key.split('~')[0]}"
|
||||||
type="${item.type}"
|
type="${item.type}"
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ class CompactProductListing extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OnMount() {
|
OnMount() {
|
||||||
console.log(this.state);
|
|
||||||
if (this.state.tags) {
|
if (this.state.tags) {
|
||||||
const tags = JSON.parse(this.state.tags);
|
const tags = JSON.parse(this.state.tags);
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -31,9 +30,11 @@ class CompactProductListing extends Component {
|
|||||||
<div class="product-listing-info">
|
<div class="product-listing-info">
|
||||||
<div class="product-listing-name">{this.state.name} {this.state.id}</div>
|
<div class="product-listing-name">{this.state.name} {this.state.id}</div>
|
||||||
</a>
|
</a>
|
||||||
${this.state.tags
|
<span class="product-listing-tags">
|
||||||
? this.state.tags.map(tag => `<tag-component name="${tag}"></tag-component>`).join('')
|
${this.state.tags
|
||||||
: ''}
|
? this.state.tags.map(tag => `<tag-component name="${tag}"></tag-component>`).join('')
|
||||||
|
: ''}
|
||||||
|
</span>
|
||||||
${this.state.discount
|
${this.state.discount
|
||||||
? `<span class="product-listing-price-full">£${parseFloat(this.state.price).toFixed(2)}</span><span class="product-listing-price-new">£${parseFloat(this.state.discount).toFixed(2)}</span>`
|
? `<span class="product-listing-price-full">£${parseFloat(this.state.price).toFixed(2)}</span><span class="product-listing-price-new">£${parseFloat(this.state.discount).toFixed(2)}</span>`
|
||||||
: `<span class="product-listing-price">£${parseFloat(this.state.price).toFixed(2)}</span>`}
|
: `<span class="product-listing-price">£${parseFloat(this.state.price).toFixed(2)}</span>`}
|
||||||
@@ -85,6 +86,11 @@ class CompactProductListing extends Component {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.product-listing-tags {
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.product-listing-price {
|
.product-listing-price {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,12 @@ class ProductList extends Component {
|
|||||||
const productsList = this.state.products || [];
|
const productsList = this.state.products || [];
|
||||||
// concat the new products to the existing products
|
// concat the new products to the existing products
|
||||||
const newProducts = productsList.concat(products.data);
|
const newProducts = productsList.concat(products.data);
|
||||||
|
|
||||||
|
const augmentable = this.state.augmentable === 'true';
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
...this.getState,
|
...this.getState,
|
||||||
|
augmentable,
|
||||||
products: newProducts,
|
products: newProducts,
|
||||||
page: products.page.page,
|
page: products.page.page,
|
||||||
per_page: products.page.per_page,
|
per_page: products.page.per_page,
|
||||||
@@ -30,7 +34,30 @@ class ProductList extends Component {
|
|||||||
this.state.products = [];
|
this.state.products = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenerateAugmentPanel(augmentable) {
|
||||||
|
if (!augmentable) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return /* html */`
|
||||||
|
<div class="augment-panel">
|
||||||
|
<div class="augment-panel-header">
|
||||||
|
<span class="augment-panel-header-text">Refine search results</span>
|
||||||
|
</div>
|
||||||
|
<div class="augment-panel-body">
|
||||||
|
<div class="augment-panel-body-row">
|
||||||
|
<span class="augment-panel-body-row-text">Weight</span>
|
||||||
|
<span class="augment-panel-body-row-text">Tag</span>
|
||||||
|
<span class="augment-panel-body-row-text"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
Render() {
|
Render() {
|
||||||
|
const augmentPanel = this.GenerateAugmentPanel(this.state.augmentable);
|
||||||
|
console.log(augmentPanel);
|
||||||
|
|
||||||
if (this.state.page * this.state.per_page >= this.state.total) {
|
if (this.state.page * this.state.per_page >= this.state.total) {
|
||||||
this.keepLoading = false;
|
this.keepLoading = false;
|
||||||
this.loadingBar = '';
|
this.loadingBar = '';
|
||||||
@@ -51,6 +78,7 @@ class ProductList extends Component {
|
|||||||
return {
|
return {
|
||||||
template: /* html */`
|
template: /* html */`
|
||||||
<h2>{this.state.title}</h2>
|
<h2>{this.state.title}</h2>
|
||||||
|
${augmentPanel}
|
||||||
<div class="product-list">
|
<div class="product-list">
|
||||||
${this.state.products.map(product => {
|
${this.state.products.map(product => {
|
||||||
return `<compact-listing-component name="${product.name}"
|
return `<compact-listing-component name="${product.name}"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class StoreFront extends Component {
|
|||||||
<img class="carousel-image" src="res/technic.png" alt="">
|
<img class="carousel-image" src="res/technic.png" alt="">
|
||||||
<div class="carousel-caption">
|
<div class="carousel-caption">
|
||||||
<h1>Check out our LEGO® Technic range</h1>
|
<h1>Check out our LEGO® Technic range</h1>
|
||||||
<a href="/search/?q=technic"><button>Show Technic Now</button></a>
|
<a href="/search/?q=technic"><button>Shop Technic Now</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="carousel-cell">
|
<div class="carousel-cell">
|
||||||
|
|||||||
@@ -47,7 +47,8 @@
|
|||||||
document.write(/* html */`
|
document.write(/* html */`
|
||||||
<product-list-component id="results"
|
<product-list-component id="results"
|
||||||
title="Search Results for '${searchQuery}'"
|
title="Search Results for '${searchQuery}'"
|
||||||
getroute="/api/search/${window.location.search}">
|
getroute="/api/search/${window.location.search}"
|
||||||
|
augmentable="true">
|
||||||
</product-list-component>
|
</product-list-component>
|
||||||
`);
|
`);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user