mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #5926 from Ocelot-Social-Community/merge-5750-in-5818
feat(webapp): hide navbar by scroll, filter button for content
This commit is contained in:
commit
cdd03a8a30
@ -1,7 +1,13 @@
|
|||||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||||
|
|
||||||
Then('I can see my new name {string} when I click on my profile picture in the top right', name => {
|
Then('I can see my new name {string} when I click on my profile picture in the top right', name => {
|
||||||
|
cy.get(".avatar-menu").then(($menu) => {
|
||||||
|
if (!$menu.is(':visible')){
|
||||||
|
cy.scrollTo("top");
|
||||||
|
cy.wait(500);
|
||||||
|
}
|
||||||
|
})
|
||||||
cy.get('.avatar-menu').click() // open
|
cy.get('.avatar-menu').click() // open
|
||||||
cy.get('.avatar-menu-popover').contains(name)
|
cy.get('.avatar-menu-popover').contains(name)
|
||||||
cy.get('.avatar-menu').click() // close again
|
cy.get('.avatar-menu').click() // close again
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,15 @@
|
|||||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||||
|
|
||||||
When("I log out", () => {
|
When("I log out", () => {
|
||||||
|
cy.get(".avatar-menu").then(($menu) => {
|
||||||
|
if (!$menu.is(':visible')){
|
||||||
|
cy.scrollTo("top");
|
||||||
|
cy.wait(500);
|
||||||
|
}
|
||||||
|
})
|
||||||
cy.get(".avatar-menu")
|
cy.get(".avatar-menu")
|
||||||
.click();
|
.click();
|
||||||
cy.get(".avatar-menu-popover")
|
cy.get(".avatar-menu-popover")
|
||||||
.find('a[href="/logout"]')
|
.find('a[href="/logout"]')
|
||||||
.click();
|
.click();
|
||||||
});
|
});
|
||||||
|
|||||||
5
webapp/assets/_new/icons/svgs/angle-up.svg
Normal file
5
webapp/assets/_new/icons/svgs/angle-up.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!-- Generated by IcoMoon.io -->
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||||
|
<title>angle-up</title>
|
||||||
|
<path d="M16 6.594l0.719 0.688 12.5 12.5-1.438 1.438-11.781-11.781-11.781 11.781-1.438-1.438 12.5-12.5z"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 275 B |
@ -11,15 +11,7 @@
|
|||||||
<base-icon class="dropdown-arrow" name="angle-down" />
|
<base-icon class="dropdown-arrow" name="angle-down" />
|
||||||
</base-button>
|
</base-button>
|
||||||
<template slot="popover">
|
<template slot="popover">
|
||||||
<div class="filter-menu-options">
|
<filter-menu-component :showMobileMenu="showMobileMenu" />
|
||||||
<h2 class="title">{{ $t('filter-menu.filter-by') }}</h2>
|
|
||||||
<following-filter />
|
|
||||||
<categories-filter v-if="categoriesActive" :showMobileMenu="showMobileMenu" />
|
|
||||||
</div>
|
|
||||||
<div class="filter-menu-options">
|
|
||||||
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>
|
|
||||||
<order-by-filter />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</dropdown>
|
</dropdown>
|
||||||
</template>
|
</template>
|
||||||
@ -27,21 +19,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import Dropdown from '~/components/Dropdown'
|
import Dropdown from '~/components/Dropdown'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import FollowingFilter from './FollowingFilter'
|
import FilterMenuComponent from './FilterMenuComponent'
|
||||||
import OrderByFilter from './OrderByFilter'
|
|
||||||
import CategoriesFilter from './CategoriesFilter'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Dropdown,
|
Dropdown,
|
||||||
FollowingFilter,
|
FilterMenuComponent,
|
||||||
OrderByFilter,
|
|
||||||
CategoriesFilter,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
placement: { type: String },
|
placement: { type: String },
|
||||||
@ -55,14 +38,3 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.filter-menu-options {
|
|
||||||
max-width: $size-max-width-filter-menu;
|
|
||||||
padding: $space-small $space-x-small;
|
|
||||||
|
|
||||||
> .title {
|
|
||||||
font-size: $font-size-large;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
46
webapp/components/FilterMenu/FilterMenuComponent.vue
Normal file
46
webapp/components/FilterMenu/FilterMenuComponent.vue
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="filter-menu-options">
|
||||||
|
<h2 class="title">{{ $t('filter-menu.filter-by') }}</h2>
|
||||||
|
<following-filter />
|
||||||
|
<categories-filter v-if="categoriesActive" :showMobileMenu="showMobileMenu" />
|
||||||
|
</div>
|
||||||
|
<div class="filter-menu-options">
|
||||||
|
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>
|
||||||
|
<order-by-filter />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FollowingFilter from './FollowingFilter'
|
||||||
|
import OrderByFilter from './OrderByFilter'
|
||||||
|
import CategoriesFilter from './CategoriesFilter'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
FollowingFilter,
|
||||||
|
OrderByFilter,
|
||||||
|
CategoriesFilter,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
showMobileMenu: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.filter-menu-options {
|
||||||
|
max-width: $size-max-width-filter-menu;
|
||||||
|
padding: $space-small $space-x-small;
|
||||||
|
|
||||||
|
> .title {
|
||||||
|
font-size: $font-size-large;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<ds-container class="main-navigation-container" style="padding: 10px 10px">
|
<ds-container
|
||||||
|
class="main-navigation-container"
|
||||||
|
:class="{ 'hide-navbar': hideNavbar }"
|
||||||
|
id="navbar"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<!-- header menu -->
|
<!-- header menu -->
|
||||||
<ds-flex v-if="!showMobileMenu" class="main-navigation-flex">
|
<ds-flex v-if="!showMobileMenu" class="main-navigation-flex">
|
||||||
@ -56,7 +60,10 @@
|
|||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<!-- filter menu -->
|
<!-- filter menu -->
|
||||||
<!-- TODO: Filter is only visible on index -->
|
<!-- TODO: Filter is only visible on index -->
|
||||||
<ds-flex-item v-if="isLoggedIn" style="flex-grow: 0; flex-basis: auto">
|
<ds-flex-item
|
||||||
|
v-if="isLoggedIn && SHOW_CONTENT_FILTER_HEADER_MENU"
|
||||||
|
style="flex-grow: 0; flex-basis: auto"
|
||||||
|
>
|
||||||
<client-only>
|
<client-only>
|
||||||
<filter-menu v-show="showFilterMenuDropdown" />
|
<filter-menu v-show="showFilterMenuDropdown" />
|
||||||
</client-only>
|
</client-only>
|
||||||
@ -227,6 +234,7 @@
|
|||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import isEmpty from 'lodash/isEmpty'
|
import isEmpty from 'lodash/isEmpty'
|
||||||
import { SHOW_GROUP_BUTTON_IN_HEADER } from '~/constants/groups.js'
|
import { SHOW_GROUP_BUTTON_IN_HEADER } from '~/constants/groups.js'
|
||||||
|
import { SHOW_CONTENT_FILTER_HEADER_MENU } from '~/constants/filter.js'
|
||||||
import LOGOS from '~/constants/logos.js'
|
import LOGOS from '~/constants/logos.js'
|
||||||
import headerMenu from '~/constants/headerMenu.js'
|
import headerMenu from '~/constants/headerMenu.js'
|
||||||
import AvatarMenu from '~/components/AvatarMenu/AvatarMenu'
|
import AvatarMenu from '~/components/AvatarMenu/AvatarMenu'
|
||||||
@ -259,10 +267,13 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
hideNavbar: false,
|
||||||
|
prevScrollpos: 0,
|
||||||
isEmpty,
|
isEmpty,
|
||||||
links,
|
links,
|
||||||
LOGOS,
|
LOGOS,
|
||||||
SHOW_GROUP_BUTTON_IN_HEADER,
|
SHOW_GROUP_BUTTON_IN_HEADER,
|
||||||
|
SHOW_CONTENT_FILTER_HEADER_MENU,
|
||||||
isHeaderMenu: headerMenu.MENU.length > 0,
|
isHeaderMenu: headerMenu.MENU.length > 0,
|
||||||
menu: headerMenu.MENU,
|
menu: headerMenu.MENU,
|
||||||
mobileSearchVisible: false,
|
mobileSearchVisible: false,
|
||||||
@ -281,14 +292,32 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleScroll() {
|
||||||
|
const currentScrollPos = window.pageYOffset
|
||||||
|
if (this.prevScrollpos > currentScrollPos) {
|
||||||
|
this.hideNavbar = false
|
||||||
|
} else {
|
||||||
|
this.hideNavbar = true
|
||||||
|
}
|
||||||
|
this.prevScrollpos = currentScrollPos
|
||||||
|
},
|
||||||
toggleMobileMenuView() {
|
toggleMobileMenuView() {
|
||||||
this.toggleMobileMenu = !this.toggleMobileMenu
|
this.toggleMobileMenu = !this.toggleMobileMenu
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
window.addEventListener('scroll', this.handleScroll)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
#navbar {
|
||||||
|
padding: 10px 10px;
|
||||||
|
}
|
||||||
|
.hide-navbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.margin-right-20 {
|
.margin-right-20 {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
2
webapp/constants/filter.js
Normal file
2
webapp/constants/filter.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export const SHOW_CONTENT_FILTER_HEADER_MENU = false
|
||||||
|
export const SHOW_CONTENT_FILTER_MASONRY_GRID = true
|
||||||
@ -5,7 +5,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ds-container>
|
<ds-container>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<nuxt />
|
<nuxt :showMobileMenu="showMobileMenu" />
|
||||||
</div>
|
</div>
|
||||||
</ds-container>
|
</ds-container>
|
||||||
<page-footer v-if="!isMobile" />
|
<page-footer v-if="!isMobile" />
|
||||||
|
|||||||
@ -267,8 +267,12 @@
|
|||||||
"happy": "Glücklich",
|
"happy": "Glücklich",
|
||||||
"surprised": "Erstaunt"
|
"surprised": "Erstaunt"
|
||||||
},
|
},
|
||||||
"filterALL": "Alle Beiträge anzeigen",
|
|
||||||
"filterFollow": "Beiträge von Benutzern filtern, denen ich folge",
|
"filterFollow": "Beiträge von Benutzern filtern, denen ich folge",
|
||||||
|
"filterMasonryGrid": {
|
||||||
|
"myFriends": "Beiträge von meinen Freunden",
|
||||||
|
"myTopics": "Meine Themen",
|
||||||
|
"noFilter": "Beiträge filtern"
|
||||||
|
},
|
||||||
"inappropriatePicture": "Dieses Bild kann für einige Menschen unangemessen sein.",
|
"inappropriatePicture": "Dieses Bild kann für einige Menschen unangemessen sein.",
|
||||||
"languageSelectLabel": "Sprache Deines Beitrags",
|
"languageSelectLabel": "Sprache Deines Beitrags",
|
||||||
"languageSelectText": "Sprache wählen",
|
"languageSelectText": "Sprache wählen",
|
||||||
@ -371,6 +375,7 @@
|
|||||||
"filter-menu": {
|
"filter-menu": {
|
||||||
"all": "Alle",
|
"all": "Alle",
|
||||||
"categories": "Themen",
|
"categories": "Themen",
|
||||||
|
"deleteFilter": "Filter löschen",
|
||||||
"emotions": "Emotionen",
|
"emotions": "Emotionen",
|
||||||
"filter-by": "Filtern nach ...",
|
"filter-by": "Filtern nach ...",
|
||||||
"following": "Benutzern, denen ich folge",
|
"following": "Benutzern, denen ich folge",
|
||||||
|
|||||||
@ -267,8 +267,12 @@
|
|||||||
"happy": "Happy",
|
"happy": "Happy",
|
||||||
"surprised": "Surprised"
|
"surprised": "Surprised"
|
||||||
},
|
},
|
||||||
"filterALL": "View all contributions",
|
|
||||||
"filterFollow": "Filter contributions from users I follow",
|
"filterFollow": "Filter contributions from users I follow",
|
||||||
|
"filterMasonryGrid": {
|
||||||
|
"myFriends": "Posts from my friends",
|
||||||
|
"myTopics": "My topics",
|
||||||
|
"noFilter": "Filter posts"
|
||||||
|
},
|
||||||
"inappropriatePicture": "This image may be inappropriate for some people.",
|
"inappropriatePicture": "This image may be inappropriate for some people.",
|
||||||
"languageSelectLabel": "Language of your contribution",
|
"languageSelectLabel": "Language of your contribution",
|
||||||
"languageSelectText": "Select Language",
|
"languageSelectText": "Select Language",
|
||||||
@ -371,6 +375,7 @@
|
|||||||
"filter-menu": {
|
"filter-menu": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"categories": "Topics",
|
"categories": "Topics",
|
||||||
|
"deleteFilter": "Delete filter",
|
||||||
"emotions": "Emotions",
|
"emotions": "Emotions",
|
||||||
"filter-by": "Filter by ...",
|
"filter-by": "Filter by ...",
|
||||||
"following": "Users I follow",
|
"following": "Users I follow",
|
||||||
|
|||||||
@ -73,6 +73,9 @@ describe('PostIndex', () => {
|
|||||||
$route: {
|
$route: {
|
||||||
query: {},
|
query: {},
|
||||||
},
|
},
|
||||||
|
$env: {
|
||||||
|
CATEGORIES_ACTIVE: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,57 @@
|
|||||||
<ds-grid-item v-if="hashtag" :row-span="2" column-span="fullWidth">
|
<ds-grid-item v-if="hashtag" :row-span="2" column-span="fullWidth">
|
||||||
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
|
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
|
||||||
</ds-grid-item>
|
</ds-grid-item>
|
||||||
|
<!--Filter Button-->
|
||||||
|
<ds-grid-item
|
||||||
|
v-if="categoriesActive && SHOW_CONTENT_FILTER_MASONRY_GRID"
|
||||||
|
:row-span="1"
|
||||||
|
column-span="fullWidth"
|
||||||
|
class="filterButtonMenu"
|
||||||
|
:class="{ 'hide-filter': hideFilter }"
|
||||||
|
>
|
||||||
|
<base-button
|
||||||
|
class="my-filter-button"
|
||||||
|
v-if="!postsFilter['categories_some'] && !postsFilter['author']"
|
||||||
|
right
|
||||||
|
@click="showFilter = !showFilter"
|
||||||
|
filled
|
||||||
|
>
|
||||||
|
{{ $t('contribution.filterMasonryGrid.noFilter') }}
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<div id="my-filter" v-if="showFilter">
|
||||||
|
<filter-menu-component :showMobileMenu="showMobileMenu" />
|
||||||
|
</div>
|
||||||
|
</ds-grid-item>
|
||||||
|
<ds-space :margin-bottom="{ base: 'small', md: 'base', lg: 'large' }" />
|
||||||
<!-- donation info -->
|
<!-- donation info -->
|
||||||
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
|
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
|
||||||
<donation-info :goal="goal" :progress="progress" />
|
<donation-info :goal="goal" :progress="progress" />
|
||||||
@ -65,6 +116,8 @@ import { mapGetters, mapMutations } from 'vuex'
|
|||||||
import { DonationsQuery } from '~/graphql/Donations'
|
import { DonationsQuery } from '~/graphql/Donations'
|
||||||
import { filterPosts } from '~/graphql/PostQuery.js'
|
import { filterPosts } from '~/graphql/PostQuery.js'
|
||||||
import UpdateQuery from '~/components/utils/UpdateQuery'
|
import UpdateQuery from '~/components/utils/UpdateQuery'
|
||||||
|
import FilterMenuComponent from '~/components/FilterMenu/FilterMenuComponent'
|
||||||
|
import { SHOW_CONTENT_FILTER_MASONRY_GRID } from '~/constants/filter.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -74,11 +127,18 @@ export default {
|
|||||||
HcEmpty,
|
HcEmpty,
|
||||||
MasonryGrid,
|
MasonryGrid,
|
||||||
MasonryGridItem,
|
MasonryGridItem,
|
||||||
|
FilterMenuComponent,
|
||||||
},
|
},
|
||||||
mixins: [postListActions],
|
mixins: [postListActions],
|
||||||
|
props: {
|
||||||
|
showMobileMenu: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
const { hashtag = null } = this.$route.query
|
const { hashtag = null } = this.$route.query
|
||||||
return {
|
return {
|
||||||
|
hideFilter: false,
|
||||||
|
revScrollpos: 0,
|
||||||
|
showFilter: false,
|
||||||
showDonations: true,
|
showDonations: true,
|
||||||
goal: 15000,
|
goal: 15000,
|
||||||
progress: 7000,
|
progress: 7000,
|
||||||
@ -88,6 +148,8 @@ export default {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
pageSize: 12,
|
pageSize: 12,
|
||||||
hashtag,
|
hashtag,
|
||||||
|
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||||
|
SHOW_CONTENT_FILTER_MASONRY_GRID,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -95,6 +157,12 @@ export default {
|
|||||||
postsFilter: 'posts/filter',
|
postsFilter: 'posts/filter',
|
||||||
orderBy: 'posts/orderBy',
|
orderBy: 'posts/orderBy',
|
||||||
}),
|
}),
|
||||||
|
filterButtonIcon() {
|
||||||
|
if (Object.keys(this.postsFilter).length === 0) {
|
||||||
|
return this.showFilter ? 'angle-up' : 'angle-down'
|
||||||
|
}
|
||||||
|
return 'close'
|
||||||
|
},
|
||||||
finalFilters() {
|
finalFilters() {
|
||||||
let filter = this.postsFilter
|
let filter = this.postsFilter
|
||||||
if (this.hashtag) {
|
if (this.hashtag) {
|
||||||
@ -118,12 +186,33 @@ export default {
|
|||||||
this.resetCategories()
|
this.resetCategories()
|
||||||
this.toggleCategory(this.categoryId)
|
this.toggleCategory(this.categoryId)
|
||||||
}
|
}
|
||||||
|
document.addEventListener('click', this.showFilterMenu)
|
||||||
|
window.addEventListener('scroll', this.handleScroll)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations({
|
...mapMutations({
|
||||||
|
resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED',
|
||||||
resetCategories: 'posts/RESET_CATEGORIES',
|
resetCategories: 'posts/RESET_CATEGORIES',
|
||||||
toggleCategory: 'posts/TOGGLE_CATEGORY',
|
toggleCategory: 'posts/TOGGLE_CATEGORY',
|
||||||
}),
|
}),
|
||||||
|
showFilterMenu(e) {
|
||||||
|
if (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button')) {
|
||||||
|
if (!this.showFilter) return
|
||||||
|
this.showFilter = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleScroll() {
|
||||||
|
const currentScrollPos = window.pageYOffset
|
||||||
|
if (this.prevScrollpos > currentScrollPos) {
|
||||||
|
this.hideFilter = false
|
||||||
|
} else {
|
||||||
|
this.hideFilter = true
|
||||||
|
}
|
||||||
|
this.prevScrollpos = currentScrollPos
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
document.removeEventListener('click', this.showFilterMenu)
|
||||||
|
},
|
||||||
clearSearch() {
|
clearSearch() {
|
||||||
this.$router.push({ path: '/' })
|
this.$router.push({ path: '/' })
|
||||||
this.hashtag = null
|
this.hashtag = null
|
||||||
@ -194,6 +283,13 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
#my-filter {
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: rgb(189 189 189) 1px 9px 15px 1px;
|
||||||
|
max-height: 480px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.masonry-grid {
|
.masonry-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: 10px;
|
grid-gap: 10px;
|
||||||
@ -209,6 +305,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hide-filter {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.base-button.--circle.post-add-button {
|
.base-button.--circle.post-add-button {
|
||||||
height: 54px;
|
height: 54px;
|
||||||
width: 54px;
|
width: 54px;
|
||||||
@ -225,4 +325,12 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.filterButtonMenu {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 6;
|
||||||
|
margin-top: -35px;
|
||||||
|
padding: 20px 10px 5px 10px;
|
||||||
|
border-radius: 7px;
|
||||||
|
background-color: #f5f4f6;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user