Skip to content

Commit

Permalink
feat: create tag collection ui
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Sep 5, 2020
1 parent 477c017 commit 4198777
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/pages/posts/navigation/search/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
/>
</button>
</div>

<SearchTagCollections v-if="isTagCollectionsActive" />
</div>
</template>

Expand All @@ -55,10 +57,18 @@ import { mapGetters, mapActions } from 'vuex'
import { TagIcon, SearchIcon, FilterIcon, TrashIcon } from 'vue-feather-icons'
import debounce from 'lodash/debounce'
import SearchTagCollections from './SearchTagCollections'
export default {
name: 'SearchBar',
components: { SearchIcon, FilterIcon, TrashIcon },
components: {
TagIcon,
SearchIcon,
FilterIcon,
TrashIcon,
SearchTagCollections,
},
data() {
return {
Expand Down
64 changes: 64 additions & 0 deletions components/pages/posts/navigation/search/SearchTagCollections.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<div class="absolute inset-0 z-50 flex pointer-events-none text-default-text">
<div class="p-4 m-auto pointer-events-auto material-container">
<h2
class="text-lg font-semibold tracking-wide text-center text-gradient-one"
>
Tag Collections
</h2>

<!-- Tag Collections -->
<div class="mt-4">
<template v-if="getTagCollections.length">
<div
v-for="(tagCollection, index) in getTagCollections"
:key="tagCollection.name"
class="flex items-center justify-between"
>
<p class="truncate">{{ tagCollection.name }}</p>

<p
class="flex-shrink-0 tag text-default-text hover:text-default-text-muted"
@click="addTagCollectionToAddedTags(index)"
>
{{ `${tagCollection.tags.length} tags` }}
</p>
</div>
</template>

<template v-else>
<div class="text-center">
<h3>No Tag Collections available</h3>
<nuxt-link to="/premium">Create one?</nuxt-link>
</div>
</template>
</div>
</div>
</div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'SearchBar',
computed: {
...mapGetters('user', ['getTagCollections']),
},
methods: {
...mapActions('booru', ['addedTagsManager']),
...mapActions('navigation', ['tagCollectionsNavigationManager']),
addTagCollectionToAddedTags(tagCollectionIndex) {
this.addedTagsManager({
operation: 'concat',
value: this.getTagCollections[tagCollectionIndex].tags,
})
this.tagCollectionsNavigationManager({ operation: 'set', value: false })
},
},
}
</script>

0 comments on commit 4198777

Please sign in to comment.