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
});
}
return { docs: dummies };
return { docs: dummies, total: 25 };
}
export default class BdWebApi {

View File

@ -19,7 +19,15 @@
}
.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 {

View File

@ -29,6 +29,7 @@
</div>
<div v-else class="bd-onlinePh">
<div class="bd-onlinePhHeader">
<div class="bd-searchHint">{{searchHint}}</div>
<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 />
</div>
@ -66,7 +67,8 @@
localThemes: ThemeManager.localThemes,
onlineThemes: null,
loadingOnline: false,
loadingMore: false
loadingMore: false,
searchHint: ''
};
},
components: {
@ -86,11 +88,14 @@
await this.ThemeManager.refreshThemes();
},
async refreshOnline() {
this.searchHint = '';
if (this.loadingOnline || this.loadingMore) return;
this.loadingOnline = true;
try {
const getThemes = await BdWebApi.themes.get();
this.onlineThemes = getThemes;
if (!this.onlineThemes.docs) return;
this.searchHint = `${this.onlineThemes.total} Results`;
} catch (err) {
Logger.err('ThemesView', err);
} finally {