add search results text

This commit is contained in:
Jiiks 2018-12-02 00:30:20 +02:00
parent b1bd5190c1
commit a0eb43188f
3 changed files with 16 additions and 3 deletions

View File

@ -56,7 +56,7 @@ async function dummyThemes() {
author: dummyAuthor author: dummyAuthor
}); });
} }
return { docs: dummies }; return { docs: dummies, total: 25 };
} }
export default class BdWebApi { export default class BdWebApi {

View File

@ -19,7 +19,15 @@
} }
.bd-onlinePhHeader { .bd-onlinePhHeader {
padding: 0 20px 0 0; display: flex;
padding: 0 20px 0 10px;
min-height: 40px;
.bd-searchHint {
flex-grow: 1;
line-height: 40px;
color: #fff;
}
} }
.bd-onlinePhBody { .bd-onlinePhBody {

View File

@ -29,6 +29,7 @@
</div> </div>
<div v-else class="bd-onlinePh"> <div v-else class="bd-onlinePh">
<div class="bd-onlinePhHeader"> <div class="bd-onlinePhHeader">
<div class="bd-searchHint">{{searchHint}}</div>
<div class="bd-fancySearch" :class="{'bd-disabled': loadingOnline, 'bd-active': loadingOnline || (onlineThemes && onlineThemes.docs)}"> <div class="bd-fancySearch" :class="{'bd-disabled': loadingOnline, 'bd-active': loadingOnline || (onlineThemes && onlineThemes.docs)}">
<input type="text" class="bd-textInput" placeholder="Search" @keydown.enter="searchInput" @keyup.stop /> <input type="text" class="bd-textInput" placeholder="Search" @keydown.enter="searchInput" @keyup.stop />
</div> </div>
@ -66,7 +67,8 @@
localThemes: ThemeManager.localThemes, localThemes: ThemeManager.localThemes,
onlineThemes: null, onlineThemes: null,
loadingOnline: false, loadingOnline: false,
loadingMore: false loadingMore: false,
searchHint: ''
}; };
}, },
components: { components: {
@ -86,11 +88,14 @@
await this.ThemeManager.refreshThemes(); await this.ThemeManager.refreshThemes();
}, },
async refreshOnline() { async refreshOnline() {
this.searchHint = '';
if (this.loadingOnline || this.loadingMore) return; if (this.loadingOnline || this.loadingMore) return;
this.loadingOnline = true; this.loadingOnline = true;
try { try {
const getThemes = await BdWebApi.themes.get(); const getThemes = await BdWebApi.themes.get();
this.onlineThemes = getThemes; this.onlineThemes = getThemes;
if (!this.onlineThemes.docs) return;
this.searchHint = `${this.onlineThemes.total} Results`;
} catch (err) { } catch (err) {
Logger.err('ThemesView', err); Logger.err('ThemesView', err);
} finally { } finally {