🔥 Refactors minimal search to share code of parent search

This commit is contained in:
Alicia Sykes
2021-10-05 21:40:25 +01:00
parent 96f6a845a2
commit f517e31cd2
4 changed files with 81 additions and 193 deletions

View File

@@ -10,7 +10,9 @@
<router-link to="/">
<h1>{{ pageInfo.title }}</h1>
</router-link>
<MinimalSearch @user-is-searchin="(s) => { this.searchValue = s; }" :active="!modalOpen" />
<MinimalSearch
@user-is-searchin="(s) => { this.searchValue = s; }"
:active="!modalOpen" ref="filterComp" />
</div>
<div v-if="checkTheresData(sections)"
:class="`item-group-container ${!tabbedView ? 'showing-all' : ''}`">
@@ -82,7 +84,7 @@ export default {
watch: {
/* When the theme changes, then call the update method */
searchValue() {
this.tabbedView = !(this.searchValue.length > 0);
this.tabbedView = !this.searchValue || this.searchValue.length === 0;
},
},
methods: {
@@ -111,7 +113,7 @@ export default {
},
/* Clears input field, once a searched item is opened */
finishedSearching() {
this.$refs.filterComp.clearFilterInput();
this.$refs.filterComp.clearMinFilterInput();
},
/* Extracts the site name from domain, used for the searching functionality */
getDomainFromUrl(url) {