Select box design, design for search box and filters in: trending, feed, subscriptions, search page

This commit is contained in:
Karlis Cudars 2021-10-24 01:27:11 +03:00
parent 6683be1ca8
commit 988fec8ed2
6 changed files with 180 additions and 45 deletions

BIN
public/img/arrow-down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -129,4 +129,16 @@ b {
main { main {
background-color: #1d2438; background-color: #1d2438;
} }
.uk-select {
background-color: #30354b !important;
-webkit-border-radius: 20px !important;
-moz-border-radius: 20px !important;
border-radius: 20px !important;
height: auto !important;
padding: 12px 50px 12px 30px !important;
background-image: url("/img/arrow-down.png") !important;
background-size: 30px !important;
background-position: calc(100% - 15px) 11px !important;
}
</style> </style>

View file

@ -1,19 +1,25 @@
<template> <template>
<h1 <h1
v-if="isMobile" v-if="isMobile"
v-t="'titles.trending'" v-t="'titles.feed'"
style="margin-bottom: 0; padding-top: 34px; font-weight: bold;" style="margin-bottom: 0; padding-top: 34px; font-weight: bold;"
class="uk-heading-small" class="uk-heading-small"
/> />
<div class="uk-flex uk-flex-middle uk-flex-between uk-flex-row-reverse" style="padding: 34px 0"> <div class="" style="padding: 34px 0">
<div <div
class="uk-search" class="uk-search"
:style="{ :style="{
width: '100%',
}"
>
<div
class="uk-position-relative"
:style="{
float: isMobile ? 'none' : 'right',
width: isMobile ? '100%' : '35ch', width: isMobile ? '100%' : '35ch',
}" }"
> >
<div class="uk-position-relative">
<input <input
class="uk-search-input" class="uk-search-input"
style="border-radius: 9999px; padding: 12px 18px 12px 40px;" style="border-radius: 9999px; padding: 12px 18px 12px 40px;"
@ -32,9 +38,29 @@
style="position: absolute; x: 0px; y: 0px;" style="position: absolute; x: 0px; y: 0px;"
class="uk-position-center-left uk-position-small" class="uk-position-center-left uk-position-small"
/> />
<SearchSuggestions
v-show="searchText && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
/>
</div> </div>
<span class="uk-align-right@m"> <span
<select id="ddlSortBy" v-model="selectedSort" class="uk-select uk-width-auto" @change="onChange()"> class="uk-align-right@m"
:style="{
float: isMobile ? 'none' : 'right',
marginRight: isMobile ? '0px' : '20px',
}"
>
<select
id="ddlSortBy"
v-model="selectedSort"
class="uk-select uk-width-auto"
@change="onChange()"
:style="{
width: isMobile ? '100%' : 'auto',
}"
>
<option v-t="'actions.most_recent'" value="descending" /> <option v-t="'actions.most_recent'" value="descending" />
<option v-t="'actions.least_recent'" value="ascending" /> <option v-t="'actions.least_recent'" value="ascending" />
<option v-t="'actions.channel_name_asc'" value="channel_ascending" /> <option v-t="'actions.channel_name_asc'" value="channel_ascending" />
@ -42,12 +68,6 @@
</select> </select>
</span> </span>
</div> </div>
<SearchSuggestions
v-show="searchText && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
/>
<div <div
v-if="!isMobile" v-if="!isMobile"

View file

@ -1,10 +1,49 @@
<template> <template>
<h1 class="uk-text-center"> <div class="" style="padding: 34px 0">
{{ $route.query.search_query }} <div
</h1> class="uk-search"
:style="{
<label for="ddlSearchFilters" width: '100%',
><b>{{ $t("actions.filter") }}: </b></label }"
>
<div
class="uk-position-relative"
:style="{
float: isMobile ? 'none' : 'right',
width: isMobile ? '100%' : '35ch',
}"
>
<input
class="uk-search-input"
style="border-radius: 9999px; padding: 12px 18px 12px 40px;"
:style="{ backgroundColor: secondaryBackgroundColor }"
v-model="searchText"
type="text"
role="search"
:title="$t('actions.search')"
:placeholder="$t('actions.search')"
@keyup="onKeyUp"
@focus="onInputFocus"
@blur="onInputBlur"
/>
<font-awesome-icon
icon="search"
style="position: absolute; x: 0px; y: 0px;"
class="uk-position-center-left uk-position-small"
/>
<SearchSuggestions
v-show="searchText && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
/>
</div>
<span
class="uk-align-right@m"
:style="{
float: isMobile ? 'none' : 'right',
marginRight: isMobile ? '0px' : '20px',
}"
> >
<select <select
id="ddlSearchFilters" id="ddlSearchFilters"
@ -13,13 +52,17 @@
class="uk-select uk-width-auto" class="uk-select uk-width-auto"
style="height: 100%" style="height: 100%"
@change="updateResults()" @change="updateResults()"
:style="{
width: isMobile ? '100%' : 'auto',
}"
> >
<option v-for="filter in availableFilters" :key="filter" :value="filter"> <option v-for="filter in availableFilters" :key="filter" :value="filter">
{{ filter.replace("_", " ") }} {{ filter.replace("_", " ") }}
</option> </option>
</select> </select>
</span>
<hr /> </div>
</div>
<div v-if="results && results.corrected" style="height: 7vh"> <div v-if="results && results.corrected" style="height: 7vh">
{{ $t("search.did_you_mean") }} {{ $t("search.did_you_mean") }}
@ -73,9 +116,11 @@
<script> <script>
import VideoItem from "@/components/VideoItem.vue"; import VideoItem from "@/components/VideoItem.vue";
import SearchSuggestions from "@/components/SearchSuggestions";
export default { export default {
components: { components: {
SearchSuggestions,
VideoItem, VideoItem,
}, },
data() { data() {
@ -92,6 +137,7 @@ export default {
"music_playlists", "music_playlists",
], ],
selectedFilter: "all", selectedFilter: "all",
searchText: this.$route.query.search_query,
}; };
}, },
mounted() { mounted() {
@ -136,6 +182,28 @@ export default {
shouldUseVideoItem(item) { shouldUseVideoItem(item) {
return item.title; return item.title;
}, },
onKeyUp(e) {
if (e.key === "Enter") {
e.target.blur();
this.$router.push({
name: "SearchResults",
query: { search_query: this.searchText },
});
return;
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
e.preventDefault();
}
this.$refs.searchSuggestions.onKeyUp(e);
},
onInputFocus() {
this.suggestionsVisible = true;
},
onInputBlur() {
this.suggestionsVisible = false;
},
onSearchTextChange(searchText) {
this.searchText = searchText;
},
}, },
}; };
</script> </script>

View file

@ -1,8 +1,15 @@
<template> <template>
<h1
v-if="isMobile"
v-t="'titles.subscriptions'"
style="margin-bottom: 0; padding-top: 34px; font-weight: bold;"
class="uk-heading-small"
/>
<div class="uk-flex uk-flex-middle uk-flex-between uk-flex-row-reverse" style="padding: 34px 0"> <div class="uk-flex uk-flex-middle uk-flex-between uk-flex-row-reverse" style="padding: 34px 0">
<div <div
class="uk-search" class="uk-search"
:style="{ :style="{
float: isMobile ? 'none' : 'right',
width: isMobile ? '100%' : '35ch', width: isMobile ? '100%' : '35ch',
}" }"
> >
@ -25,6 +32,12 @@
style="position: absolute; x: 0px; y: 0px;" style="position: absolute; x: 0px; y: 0px;"
class="uk-position-center-left uk-position-small" class="uk-position-center-left uk-position-small"
/> />
<SearchSuggestions
v-show="searchText && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
/>
</div> </div>
<div style="text-align: center"> <div style="text-align: center">
<button <button
@ -49,12 +62,6 @@
</button> </button>
</div> </div>
</div> </div>
<SearchSuggestions
v-show="searchText && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
/>
<div <div
v-if="!isMobile" v-if="!isMobile"
@ -105,11 +112,17 @@
</template> </template>
<script> <script>
import SearchSuggestions from "@/components/SearchSuggestions";
export default { export default {
components: {
SearchSuggestions,
},
data() { data() {
return { return {
subscriptions: [], subscriptions: [],
loading: true, loading: true,
searchText: "",
}; };
}, },
mounted() { mounted() {
@ -180,6 +193,28 @@ export default {
elem.click(); elem.click();
elem.remove(); elem.remove();
}, },
onKeyUp(e) {
if (e.key === "Enter") {
e.target.blur();
this.$router.push({
name: "SearchResults",
query: { search_query: this.searchText },
});
return;
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
e.preventDefault();
}
this.$refs.searchSuggestions.onKeyUp(e);
},
onInputFocus() {
this.suggestionsVisible = true;
},
onInputBlur() {
this.suggestionsVisible = false;
},
onSearchTextChange(searchText) {
this.searchText = searchText;
},
}, },
}; };
</script> </script>

View file

@ -33,13 +33,13 @@
class="uk-position-center-left uk-position-small" class="uk-position-center-left uk-position-small"
/> />
</div> </div>
</div>
<SearchSuggestions <SearchSuggestions
v-show="searchText && suggestionsVisible" v-show="searchText && suggestionsVisible"
ref="searchSuggestions" ref="searchSuggestions"
:search-text="searchText" :search-text="searchText"
@searchchange="onSearchTextChange" @searchchange="onSearchTextChange"
/> />
</div>
<div <div
v-if="!isMobile" v-if="!isMobile"