Layout improved for Searcg Result page

This commit is contained in:
Moriz Wahl 2020-09-24 12:21:57 +02:00
parent 7bf9dfde29
commit af56c3dd4b
6 changed files with 36 additions and 12 deletions

View File

@ -1,12 +1,14 @@
<template> <template>
<div id="search-results" class="search-results"> <div id="search-results" class="search-results">
<div> <div>
<ds-section> <ds-text class="total-search-results">
<ds-text class="total-search-results"> {{ $t('search.for') }} "
<strong>{{ searchCount }}</strong> <strong>{{ search }}</strong>
{{ $t('search.results', {}, searchCount) }} "
</ds-text> <br />
</ds-section> <strong>{{ searchCount }}</strong>
{{ $t('search.results', {}, searchCount) }}
</ds-text>
</div> </div>
<tab-navigation :tabs="tabOptions" :activeTab="activeTab" @switchTab="switchTab" /> <tab-navigation :tabs="tabOptions" :activeTab="activeTab" @switchTab="switchTab" />
@ -63,6 +65,7 @@
@next="nextResults" @next="nextResults"
:key="'Bottom'" :key="'Bottom'"
:pageSize="pageSize" :pageSize="pageSize"
:srollTo="'#search-results'"
/> />
</template> </template>
</section> </section>
@ -148,17 +151,20 @@ export default {
return [ return [
{ {
type: 'Post', type: 'Post',
title: `${this.postCount} ${this.$t('search.heading.Post', {}, this.postCount)}`, title: this.$t('search.heading.Post', {}, this.postCount),
count: this.postCount,
disabled: this.postCount === 0, disabled: this.postCount === 0,
}, },
{ {
type: 'User', type: 'User',
title: `${this.userCount} ${this.$t('search.heading.User', {}, this.userCount)}`, title: this.$t('search.heading.User', {}, this.userCount),
count: this.userCount,
disabled: this.userCount === 0, disabled: this.userCount === 0,
}, },
{ {
type: 'Hashtag', type: 'Hashtag',
title: `${this.hashtagCount} ${this.$t('search.heading.Tag', {}, this.hashtagCount)}`, title: this.$t('search.heading.Tag', {}, this.hashtagCount),
count: this.hashtagCount,
disabled: this.hashtagCount === 0, disabled: this.hashtagCount === 0,
}, },
] ]
@ -206,6 +212,7 @@ export default {
} }
}, },
nextResults() { nextResults() {
// scroll to top??
switch (this.activeTab) { switch (this.activeTab) {
case 'Post': case 'Post':
this.postPage++ this.postPage++

View File

@ -13,7 +13,6 @@ describe('PaginationButtons.vue', () => {
let wrapper let wrapper
const mocks = { const mocks = {
$t: jest.fn(), $t: jest.fn(),
scrollTo: jest.fn(),
} }
const Wrapper = () => { const Wrapper = () => {

View File

@ -19,7 +19,6 @@
icon="arrow-right" icon="arrow-right"
circle circle
class="next-button" class="next-button"
v-scroll-to="'#search-results'"
/> />
</div> </div>
</template> </template>

View File

@ -11,14 +11,26 @@
]" ]"
role="button" role="button"
@click="$emit('switchTab', tab.type)" @click="$emit('switchTab', tab.type)"
:style="tabWidth"
> >
{{ tab.title }} <ds-space margin="small">
<client-only placeholder="Loading...">
<ds-number :label="tab.title">
<hc-count-to slot="count" :end-val="tab.count" />
</ds-number>
</client-only>
</ds-space>
</li> </li>
</ul> </ul>
</template> </template>
<script> <script>
import HcCountTo from '~/components/CountTo.vue'
export default { export default {
components: {
HcCountTo,
},
props: { props: {
tabs: { tabs: {
type: Array, type: Array,
@ -28,6 +40,11 @@ export default {
type: String, type: String,
}, },
}, },
computed: {
tabWidth() {
return 'width: ' + String(100.0 / this.tabs.length) + '%'
},
},
} }
</script> </script>

View File

@ -589,6 +589,7 @@
}, },
"search": { "search": {
"failed": "Nichts gefunden", "failed": "Nichts gefunden",
"for": "Suche nach ",
"heading": { "heading": {
"Post": "Beitrag ::: Beiträge", "Post": "Beitrag ::: Beiträge",
"Tag": "Hashtag ::: Hashtags", "Tag": "Hashtag ::: Hashtags",

View File

@ -589,6 +589,7 @@
}, },
"search": { "search": {
"failed": "Nothing found", "failed": "Nothing found",
"for": "Searching for ",
"heading": { "heading": {
"Post": "Post ::: Posts", "Post": "Post ::: Posts",
"Tag": "Hashtag ::: Hashtags", "Tag": "Hashtag ::: Hashtags",