Different sidebar headers for nearby and full search
This commit is contained in:
@@ -145,6 +145,11 @@ export default class PlacesSidebar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isNearbySearch() {
|
||||||
|
const qp = this.router.currentRoute.queryParams;
|
||||||
|
return !qp.q && qp.lat && qp.lon;
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<div class="sidebar-header">
|
<div class="sidebar-header">
|
||||||
@@ -155,7 +160,11 @@ export default class PlacesSidebar extends Component {
|
|||||||
{{on "click" this.clearSelection}}
|
{{on "click" this.clearSelection}}
|
||||||
><Icon @name="arrow-left" @size={{20}} @color="#333" /></button>
|
><Icon @name="arrow-left" @size={{20}} @color="#333" /></button>
|
||||||
{{else}}
|
{{else}}
|
||||||
<h2><Icon @name="target" @size={{20}} @color="#ea4335" /> Nearby</h2>
|
{{#if this.isNearbySearch}}
|
||||||
|
<h2><Icon @name="target" @size={{20}} @color="#ea4335" /> Nearby</h2>
|
||||||
|
{{else}}
|
||||||
|
<h2><Icon @name="search" @size={{20}} @color="#333" /> Results</h2>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button type="button" class="close-btn" {{on "click" @onClose}}><Icon
|
<button type="button" class="close-btn" {{on "click" @onClose}}><Icon
|
||||||
@name="x"
|
@name="x"
|
||||||
@@ -205,7 +214,11 @@ export default class PlacesSidebar extends Component {
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="empty-state">No places found nearby.</p>
|
{{#if this.isNearbySearch}}
|
||||||
|
<p class="empty-state">No places found nearby.</p>
|
||||||
|
{{else}}
|
||||||
|
<p class="empty-state">No results found.</p>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ module('Acceptance | search', function (hooks) {
|
|||||||
await visit('/search?q=Berlin');
|
await visit('/search?q=Berlin');
|
||||||
|
|
||||||
assert.strictEqual(currentURL(), '/search?q=Berlin');
|
assert.strictEqual(currentURL(), '/search?q=Berlin');
|
||||||
|
assert.dom('.sidebar-header h2').includesText('Results');
|
||||||
assert.dom('.places-list li').exists({ count: 2 });
|
assert.dom('.places-list li').exists({ count: 2 });
|
||||||
assert.dom('.places-list li:first-child .place-name').hasText('Berlin');
|
assert.dom('.places-list li:first-child .place-name').hasText('Berlin');
|
||||||
});
|
});
|
||||||
@@ -99,6 +100,7 @@ module('Acceptance | search', function (hooks) {
|
|||||||
await visit('/search?lat=52.52&lon=13.405');
|
await visit('/search?lat=52.52&lon=13.405');
|
||||||
|
|
||||||
assert.strictEqual(currentURL(), '/search?lat=52.52&lon=13.405');
|
assert.strictEqual(currentURL(), '/search?lat=52.52&lon=13.405');
|
||||||
|
assert.dom('.sidebar-header h2').includesText('Nearby');
|
||||||
assert.dom('.places-list li').exists({ count: 1 });
|
assert.dom('.places-list li').exists({ count: 1 });
|
||||||
assert.dom('.places-list li .place-name').hasText('Nearby Cafe');
|
assert.dom('.places-list li .place-name').hasText('Nearby Cafe');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user