filters colored which were selected by filter

This commit is contained in:
ogerly 2023-02-09 09:14:37 +01:00
parent 3dfcf4df9f
commit 11e992aa1d
3 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<ds-tag class="category-tag"> <ds-tag class="category-tag" :class="filterActive ? 'filterActive' : ''">
<base-icon :name="icon" /> <base-icon :name="icon" />
{{ name }} {{ name }}
</ds-tag> </ds-tag>
@ -11,6 +11,7 @@ export default {
props: { props: {
icon: { type: String, required: true }, icon: { type: String, required: true },
name: { type: String, default: '' }, name: { type: String, default: '' },
filterActive: { type: Boolean, default: false, required: false },
}, },
} }
</script> </script>
@ -28,4 +29,7 @@ export default {
font-size: $font-size-base; font-size: $font-size-base;
} }
} }
.filterActive{
background-color: $color-success-active;
}
</style> </style>

View File

@ -37,6 +37,7 @@
placement: 'bottom-start', placement: 'bottom-start',
}" }"
:icon="category.icon" :icon="category.icon"
:filterActive="postsFilter ? postsFilter.id_in.includes(category.id) : false"
/> />
</div> </div>
<div v-else class="categories-placeholder"></div> <div v-else class="categories-placeholder"></div>
@ -107,6 +108,10 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
postsFilter: {
type: Object,
default: () => {},
},
}, },
data() { data() {
return { return {

View File

@ -93,6 +93,7 @@
> >
<post-teaser <post-teaser
:post="post" :post="post"
:postsFilter="postsFilter['categories_some']"
@removePostFromList="posts = removePostFromList(post, posts)" @removePostFromList="posts = removePostFromList(post, posts)"
@pinPost="pinPost(post, refetchPostList)" @pinPost="pinPost(post, refetchPostList)"
@unpinPost="unpinPost(post, refetchPostList)" @unpinPost="unpinPost(post, refetchPostList)"