make more generic

This commit is contained in:
taehoon 2019-04-02 16:02:02 -04:00
parent fc5f4fba8c
commit 1cf9780e05
4 changed files with 7 additions and 8 deletions

View File

@ -1,5 +1,3 @@
import BlockCard from '../block_card/block_card.vue'
const debounceMilliseconds = 500 const debounceMilliseconds = 500
export default { export default {
@ -16,9 +14,6 @@ export default {
default: 'Search...' default: 'Search...'
} }
}, },
components: {
BlockCard
},
data () { data () {
return { return {
term: '', term: '',

View File

@ -2,7 +2,8 @@
<div class="user-autosuggest" v-click-outside="onClickOutside"> <div class="user-autosuggest" v-click-outside="onClickOutside">
<input v-model="term" :placeholder="placeholder" @click="onInputClick" class="user-autosuggest-input" /> <input v-model="term" :placeholder="placeholder" @click="onInputClick" class="user-autosuggest-input" />
<div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0"> <div class="user-autosuggest-results" v-if="resultsVisible && filtered.length > 0">
<BlockCard v-for="userId in filtered" :key="userId" :userId="userId"/> <slot v-for="item in filtered" :item="item">
</slot>
</div> </div>
</div> </div>
</template> </template>

View File

@ -78,7 +78,8 @@ const UserSettings = {
BlockList, BlockList,
MuteList, MuteList,
EmojiInput, EmojiInput,
UserAutoSuggest UserAutoSuggest,
BlockCard
}, },
computed: { computed: {
user () { user () {

View File

@ -196,7 +196,9 @@
<div :label="$t('settings.blocks_tab')"> <div :label="$t('settings.blocks_tab')">
<div class="profile-edit-usersearch-wrapper"> <div class="profile-edit-usersearch-wrapper">
<UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block" /> <UserAutoSuggest :filter="filterUnblockedUsers" :query="queryUserIds" placeholder="Search whom you want to block">
<BlockCard slot-scope="row" :userId="row.item"/>
</UserAutoSuggest>
</div> </div>
<block-list :refresh="true"> <block-list :refresh="true">
<template slot="empty">{{$t('settings.no_blocks')}}</template> <template slot="empty">{{$t('settings.no_blocks')}}</template>