Merge pull request #6109 from Ocelot-Social-Community/feat-filter-buttons

feat(webapp): filter button style change
This commit is contained in:
Hannes Heine 2023-03-14 11:57:19 +01:00 committed by GitHub
commit 3e283bf0ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 40 deletions

View File

@ -0,0 +1,57 @@
<template>
<span>
<base-button
class="my-filter-button my-filter-button-selected"
right
@click="clickButton"
filled
>
{{ title }}
</base-button>
<base-button
class="filter-remove"
@click="clickRemove"
icon="close"
:title="titleRemove"
size="small"
circle
filled
/>
</span>
</template>
<script>
export default {
name: 'HeaderButton',
props: {
title: {
type: String,
required: true,
},
clickButton: {
type: Function,
required: true,
},
titleRemove: {
type: String,
required: true,
},
clickRemove: {
type: Function,
required: true,
},
},
}
</script>
<style lang="scss">
.my-filter-button-selected {
padding-right: 30px;
margin-top: 4px;
}
.base-button.filter-remove {
position: relative;
margin-left: -31px;
top: -5px;
margin-right: 8px;
}
</style>

View File

@ -43,47 +43,30 @@
&nbsp;
<base-icon class="my-filter-button" :name="filterButtonIcon"></base-icon>
</base-button>
<span v-if="postsFilter['categories_some']">
<base-button class="my-filter-button" right @click="showFilter = !showFilter" filled>
{{ $t('contribution.filterMasonryGrid.myTopics') }}
</base-button>
<base-button
class="filter-remove"
@click="resetCategories"
icon="close"
:title="$t('filter-menu.deleteFilter')"
style="margin-left: -8px"
filled
/>
</span>
<span v-if="postsFilter['author']">
<base-button class="my-filter-button" right @click="showFilter = !showFilter" filled>
{{ $t('contribution.filterMasonryGrid.myFriends') }}
</base-button>
<base-button
class="filter-remove"
@click="resetByFollowed"
icon="close"
:title="$t('filter-menu.deleteFilter')"
style="margin-left: -8px"
filled
/>
</span>
<span v-if="postsFilter['postsInMyGroups']">
<base-button class="my-filter-button" right @click="showFilter = !showFilter" filled>
{{ $t('contribution.filterMasonryGrid.myGroups') }}
</base-button>
<base-button
class="filter-remove"
@click="resetByGroups"
icon="close"
:title="$t('filter-menu.deleteFilter')"
style="margin-left: -8px"
filled
<header-button
v-if="postsFilter['categories_some']"
:title="$t('contribution.filterMasonryGrid.myTopics')"
:clickButton="openFilterMenu"
:titleRemove="$t('filter-menu.deleteFilter')"
:clickRemove="resetCategories"
/>
</span>
<header-button
v-if="postsFilter['author']"
:title="$t('contribution.filterMasonryGrid.myFriends')"
:clickButton="openFilterMenu"
:titleRemove="$t('filter-menu.deleteFilter')"
:clickRemove="resetByFollowed"
/>
<header-button
v-if="postsFilter['postsInMyGroups']"
:title="$t('contribution.filterMasonryGrid.myGroups')"
:clickButton="openFilterMenu"
:titleRemove="$t('filter-menu.deleteFilter')"
:clickRemove="resetByGroups"
/>
<div id="my-filter" v-if="showFilter">
<div @mouseleave="showFilter = false">
<filter-menu-component @showFilterMenu="showFilterMenu" />
@ -142,6 +125,7 @@ import HcEmpty from '~/components/Empty/Empty'
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
import HeaderButton from '~/components/FilterMenu/HeaderButton'
import { mapGetters, mapMutations } from 'vuex'
import { DonationsQuery } from '~/graphql/Donations'
import { filterPosts } from '~/graphql/PostQuery.js'
@ -159,6 +143,7 @@ export default {
MasonryGrid,
MasonryGridItem,
FilterMenuComponent,
HeaderButton,
},
mixins: [postListActions],
data() {
@ -225,6 +210,9 @@ export default {
resetCategories: 'posts/RESET_CATEGORIES',
toggleCategory: 'posts/TOGGLE_CATEGORY',
}),
openFilterMenu() {
this.showFilter = !this.showFilter
},
showFilterMenu(e) {
if (!e || (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button'))) {
if (!this.showFilter) return
@ -354,13 +342,18 @@ export default {
align-items: center;
}
.filterButtonMenu {
width: 95%;
position: fixed;
z-index: 6;
margin-top: -35px;
padding: 20px 10px 5px 10px;
border-radius: 7px;
background-color: #f5f4f6;
}
@media screen and (max-width: 656px) {
.filterButtonMenu {
margin-top: -50px;
}
}
#my-filter {
background-color: white;
box-shadow: rgb(189 189 189) 1px 9px 15px 1px;