Added color square to category filter
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
|||||||
|
|
||||||
import SearchList from "./lists/SearchList.vue"
|
import SearchList from "./lists/SearchList.vue"
|
||||||
import type { Category } from "~/models/Category"
|
import type { Category } from "~/models/Category"
|
||||||
|
import { cn } from "~/lib/utils"
|
||||||
|
|
||||||
const { isAdvancedSearchOpen, allEvents, categories } = storeToRefs(useCalendar())
|
const { isAdvancedSearchOpen, allEvents, categories } = storeToRefs(useCalendar())
|
||||||
const { characters } = storeToRefs(useCharacters())
|
const { characters } = storeToRefs(useCharacters())
|
||||||
@@ -316,8 +317,14 @@ function handleCategoryUnselect(e: Category) {
|
|||||||
<div class="grow flex justify-end items-center gap-1">
|
<div class="grow flex justify-end items-center gap-1">
|
||||||
<UiTagsInput class="grow px-0 gap-y-1 w-80">
|
<UiTagsInput class="grow px-0 gap-y-1 w-80">
|
||||||
<div v-if="selectedCategories.length > 0" class="flex gap-2 flex-wrap items-center px-3">
|
<div v-if="selectedCategories.length > 0" class="flex gap-2 flex-wrap items-center px-3">
|
||||||
<UiTagsInputItem v-for="item in selectedCategories" :key="item.id" :value="item.name">
|
<UiTagsInputItem v-for="cat in selectedCategories" :key="cat.id" :value="cat.name">
|
||||||
<UiTagsInputItemText class="capitalize cursor-pointer" @click="handleCategoryUnselect(item)" />
|
<button
|
||||||
|
class="bgc px-2 capitalize cursor-pointer"
|
||||||
|
:class="cn(`element-${cat.color}`)"
|
||||||
|
@click="handleCategoryUnselect(cat)"
|
||||||
|
>
|
||||||
|
{{ capitalize(cat.name) }}
|
||||||
|
</button>
|
||||||
</UiTagsInputItem>
|
</UiTagsInputItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -356,7 +363,12 @@ function handleCategoryUnselect(e: Category) {
|
|||||||
:value="cat"
|
:value="cat"
|
||||||
@select.prevent="handleCategorySelect(cat)"
|
@select.prevent="handleCategorySelect(cat)"
|
||||||
>
|
>
|
||||||
{{ capitalize(cat.name) }}
|
<span
|
||||||
|
class="bgc"
|
||||||
|
:class="cn(`element-${cat.color}`)"
|
||||||
|
>
|
||||||
|
{{ capitalize(cat.name) }}
|
||||||
|
</span>
|
||||||
</UiCommandItem>
|
</UiCommandItem>
|
||||||
</UiCommandGroup>
|
</UiCommandGroup>
|
||||||
</UiCommandList>
|
</UiCommandList>
|
||||||
@@ -401,7 +413,7 @@ function handleCategoryUnselect(e: Category) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr >
|
<hr>
|
||||||
|
|
||||||
<div v-if="searchResults.length > 0" ref="searchResultsRef" class="grow overflow-y-auto">
|
<div v-if="searchResults.length > 0" ref="searchResultsRef" class="grow overflow-y-auto">
|
||||||
<SearchList
|
<SearchList
|
||||||
|
|||||||
Reference in New Issue
Block a user