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

View File

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

View File

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