Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webapp): hide navbar by scroll, filter button for content #5926

Merged
merged 29 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3040f21
hide navbar by scroll down, show navbar by scroll up
ogerly Jan 22, 2023
5765f47
fix lint
ogerly Jan 22, 2023
b9067d7
filter menu in content page
ogerly Jan 23, 2023
8759c4a
find key in object change
ogerly Jan 24, 2023
983e7e1
filter for themen and friends in content page per button, close funktion
ogerly Jan 25, 2023
5ceec78
fix: lint
ogerly Jan 25, 2023
4a8f466
fix: locales
ogerly Jan 25, 2023
fd6d2da
add delete filter funktion
ogerly Jan 25, 2023
6c5f042
style color change, position change
ogerly Jan 25, 2023
ede6998
change style for remove filter
ogerly Jan 26, 2023
69e8214
Merge branch '5818-Display-filter-as-buttons-instead-of-filter-menu' …
ogerly Jan 26, 2023
9aef64e
scroll and filter button merged
ogerly Jan 31, 2023
d4596b3
add locales deleteFilter
ogerly Jan 31, 2023
a5af42c
scroll in filtermenu
ogerly Feb 3, 2023
f0069c7
add constants filter headermenu and content button
ogerly Feb 3, 2023
930d820
add constants filter on headermenu and index
ogerly Feb 3, 2023
a6db7e9
fix test
ogerly Feb 3, 2023
9497a9c
change css height filter box
ogerly Feb 3, 2023
6d9b813
fix lint
ogerly Feb 3, 2023
6e646d5
add angle up icon
Mogge Feb 3, 2023
4c282fb
Update webapp/locales/en.json
ogerly Feb 3, 2023
31c28aa
Update webapp/locales/en.json
ogerly Feb 3, 2023
e8d33ab
Update webapp/components/HeaderMenu/HeaderMenu.vue
ogerly Feb 3, 2023
18749f4
only one if instead of two
Mogge Feb 3, 2023
66b7a6d
scroll to top to ensure that avatar menu is visible before clicking o…
Mogge Feb 3, 2023
60b9d57
Merge branch 'master' into merge-5750-in-5818
Mogge Feb 3, 2023
8bfe486
linting
Mogge Feb 3, 2023
f5c05de
only scroll to top if avatar menu is not visible
Mogge Feb 6, 2023
66c74fb
test if avatar menu is visible and scroll top
Mogge Feb 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions webapp/components/FilterMenu/FilterMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,20 @@
<base-icon class="dropdown-arrow" name="angle-down" />
</base-button>
<template slot="popover">
<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>
<filter-menu-component :showMobileMenu="showMobileMenu" />
</template>
</dropdown>
</template>

<script>
import Dropdown from '~/components/Dropdown'
import { mapGetters } from 'vuex'
import FollowingFilter from './FollowingFilter'
import OrderByFilter from './OrderByFilter'
import CategoriesFilter from './CategoriesFilter'
import FilterMenuComponent from './FilterMenuComponent'

export default {
components: {
Dropdown,
FollowingFilter,
OrderByFilter,
CategoriesFilter,
},
data() {
return {
categoriesActive: this.$env.CATEGORIES_ACTIVE,
}
FilterMenuComponent,
},
props: {
placement: { type: String },
Expand All @@ -55,14 +38,3 @@ export default {
},
}
</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 changes: 46 additions & 0 deletions webapp/components/FilterMenu/FilterMenuComponent.vue
Original file line number Diff line number Diff line change
@@ -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>
30 changes: 28 additions & 2 deletions webapp/components/HeaderMenu/HeaderMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<ds-container class="main-navigation-container" style="padding: 10px 10px">
<ds-container
class="main-navigation-container"
:class="{ 'hide-navbar': hideNavbar }"
id="navbar"
>
<div>
<!-- header menu -->
<ds-flex v-if="!showMobileMenu" class="main-navigation-flex">
Expand Down Expand Up @@ -59,7 +63,7 @@
TODO: Filter is only visible on index
-->
<ds-flex-item v-if="isLoggedIn" style="flex-grow: 0; flex-basis: auto">
Mogge marked this conversation as resolved.
Show resolved Hide resolved
<client-only>
<client-only v-if="SHOW_CONTENT_FILTER_HEADER_MENU">
Mogge marked this conversation as resolved.
Show resolved Hide resolved
<filter-menu v-show="showFilterMenuDropdown" />
</client-only>
</ds-flex-item>
Expand Down Expand Up @@ -207,6 +211,7 @@
<script>
import { mapGetters } from 'vuex'
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 headerMenu from '~/constants/headerMenu.js'
import AvatarMenu from '~/components/AvatarMenu/AvatarMenu'
Expand Down Expand Up @@ -237,9 +242,12 @@ export default {
},
data() {
return {
hideNavbar: false,
prevScrollpos: 0,
links,
LOGOS,
SHOW_GROUP_BUTTON_IN_HEADER,
SHOW_CONTENT_FILTER_HEADER_MENU,
isHeaderMenu: headerMenu.MENU.length > 0,
menu: headerMenu.MENU,
mobileSearchVisible: false,
Expand All @@ -258,14 +266,32 @@ export default {
},
},
methods: {
handleScroll() {
const currentScrollPos = window.pageYOffset
if (this.prevScrollpos > currentScrollPos) {
this.hideNavbar = false
} else {
this.hideNavbar = true
}
this.prevScrollpos = currentScrollPos
},
toggleMobileMenuView() {
this.toggleMobileMenu = !this.toggleMobileMenu
},
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
},
}
</script>

<style lang="scss">
#navbar {
padding: 10px 10px;
}
.hide-navbar {
display: none;
}
.margin-right-20 {
margin-right: 20px;
}
Expand Down
2 changes: 2 additions & 0 deletions webapp/constants/filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const SHOW_CONTENT_FILTER_HEADER_MENU = false
export const SHOW_CONTENT_FILTER_MASONRY_GRID = true
2 changes: 1 addition & 1 deletion webapp/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<ds-container>
<div class="main-container">
<nuxt />
<nuxt :showMobileMenu="showMobileMenu" />
</div>
</ds-container>
<page-footer v-if="!showMobileMenu" />
Expand Down
7 changes: 6 additions & 1 deletion webapp/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,12 @@
"happy": "Glücklich",
"surprised": "Erstaunt"
},
"filterALL": "Alle Beiträge anzeigen",
"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.",
"languageSelectLabel": "Sprache Deines Beitrags",
"languageSelectText": "Sprache wählen",
Expand Down Expand Up @@ -371,6 +375,7 @@
"filter-menu": {
"all": "Alle",
"categories": "Themen",
"deleteFilter": "Filter löschen",
"emotions": "Emotionen",
"filter-by": "Filtern nach ...",
"following": "Benutzern, denen ich folge",
Expand Down
7 changes: 6 additions & 1 deletion webapp/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,12 @@
"happy": "Happy",
"surprised": "Surprised"
},
"filterALL": "View all contributions",
"filterFollow": "Filter contributions from users I follow",
"filterMasonryGrid": {
"myFriends": "Posts From My Friends",
ogerly marked this conversation as resolved.
Show resolved Hide resolved
"myTopics": "My topics",
"noFilter": "Filter Posts"
ogerly marked this conversation as resolved.
Show resolved Hide resolved
},
"inappropriatePicture": "This image may be inappropriate for some people.",
"languageSelectLabel": "Language of your contribution",
"languageSelectText": "Select Language",
Expand Down Expand Up @@ -371,6 +375,7 @@
"filter-menu": {
"all": "All",
"categories": "Topics",
"deleteFilter": "Delete filter",
"emotions": "Emotions",
"filter-by": "Filter by ...",
"following": "Users I follow",
Expand Down
3 changes: 3 additions & 0 deletions webapp/pages/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ describe('PostIndex', () => {
$route: {
query: {},
},
$env: {
CATEGORIES_ACTIVE: true,
},
}
})

Expand Down
Loading