This commit is contained in:
Dragos 2022-12-18 12:57:20 +02:00 committed by GitHub
parent 10438ab777
commit 3444c96118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@
><img alt="logo" src="/img/icons/logo.svg" height="32" width="32" />iped</router-link ><img alt="logo" src="/img/icons/logo.svg" height="32" width="32" />iped</router-link
> >
</div> </div>
<div class="lt-md:hidden flex flex-1 justify-start"> <div class="lt-md:hidden flex flex-1 justify-start" style="position: relative">
<input <input
v-model="searchText" v-model="searchText"
type="text" type="text"
@ -54,7 +54,7 @@
</nav> </nav>
<!-- search suggestions for mobile devices --> <!-- search suggestions for mobile devices -->
<div class="w-{full - 4} md:hidden mx-2"> <div class="w-{full - 4} md:hidden mx-2" style="position: relative">
<input <input
v-model="searchText" v-model="searchText"
type="text" type="text"
@ -66,6 +66,7 @@
@focus="onInputFocus" @focus="onInputFocus"
@blur="onInputBlur" @blur="onInputBlur"
/> />
<span v-if="searchText" class="delete-search" @click="searchText = ''">x</span>
</div> </div>
<SearchSuggestions <SearchSuggestions
v-show="(searchText || showSearchHistory) && suggestionsVisible" v-show="(searchText || showSearchHistory) && suggestionsVisible"
@ -104,23 +105,37 @@
width: auto; width: auto;
margin: 0 -5rem; margin: 0 -5rem;
} }
.delete-search {
position: absolute;
display: flex;
right: 6rem;
top: 5.5rem;
height: 30rem;
width: 30rem;
cursor: pointer;
background-color: var(--efy_bg1);
border: var(--efy_border);
border-radius: var(--efy_radius0);
place-content: center;
font-size: 20rem;
color: var(--efy_text);
flex-wrap: wrap;
align-content: center;
}
</style> </style>
<script> <script>
import SearchSuggestions from "./SearchSuggestions.vue"; import SearchSuggestions from "./SearchSuggestions.vue";
import hotkeys from "hotkeys-js"; import hotkeys from "hotkeys-js";
import LoginModal from "./LoginModal.vue";
export default { export default {
components: { components: {
SearchSuggestions, SearchSuggestions,
LoginModal,
}, },
data() { data() {
return { return {
searchText: "", searchText: "",
suggestionsVisible: false, suggestionsVisible: false,
showTopNav: false, showTopNav: false,
showLoginModal: false,
}; };
}, },
mounted() { mounted() {
@ -138,8 +153,8 @@ export default {
shouldShowTrending(_this) { shouldShowTrending(_this) {
return _this.getPreferenceString("homepage", "trending") != "trending"; return _this.getPreferenceString("homepage", "trending") != "trending";
}, },
showSearchHistory() { showSearchHistory(_this) {
return localStorage.getItem("searchHistory") && localStorage.getItem("search_history"); return _this.getPreferenceBoolean("searchHistory", false) && localStorage.getItem("search_history");
}, },
}, },
methods: { methods: {