make nav bar slide, move mobile post status to mobile nav

This commit is contained in:
shpuld 2019-03-14 17:46:04 +02:00
parent 7ce8fe9214
commit f19284357e
6 changed files with 105 additions and 84 deletions

View file

@ -484,24 +484,6 @@ nav {
}
}
.menu-button {
display: none;
position: relative;
}
.alert-dot {
border-radius: 100%;
height: 8px;
width: 8px;
position: absolute;
left: calc(50% - 4px);
top: calc(50% - 4px);
margin-left: 6px;
margin-top: -6px;
background-color: $fallback--cRed;
background-color: var(--badgeNotification, $fallback--cRed);
}
.fade-enter-active, .fade-leave-active {
transition: opacity .2s
}
@ -530,20 +512,6 @@ nav {
display: none;
}
.panel-switcher {
display: none;
width: 100%;
height: 46px;
button {
display: block;
flex: 1;
max-height: 32px;
margin: 0.5em;
padding: 0.5em;
}
}
@media all and (min-width: 800px) {
body {
overflow-y: scroll;
@ -671,46 +639,6 @@ nav {
border-radius: var(--inputRadius, $fallback--inputRadius);
}
.mobile-notifications {
position: fixed;
width: 100vw;
height: 100vh;
top: calc(50px - 28px - 1.2em);
left: 0;
z-index: 999;
overflow-x: hidden;
overflow-y: scroll;
transition-property: transform;
transition-duration: 0.25s;
transform: translate(0);
background-color: $fallback--bg;
background-color: var(--bg, $fallback--bg);
.notifications {
margin: 0;
padding: 0;
border-radius: 0;
box-shadow: none;
.panel {
border-radius: 0;
margin: 0;
box-shadow: none;
}
.panel:after {
border-radius: 0;
}
.panel .panel-heading {
border-radius: 0;
box-shadow: none;
}
}
&.closed {
transform: translate(100%);
}
}
@keyframes modal-background-fadein {
from {
background-color: rgba(0, 0, 0, 0);

View file

@ -46,13 +46,6 @@
<media-modal></media-modal>
</div>
<chat-panel :floating="true" v-if="currentUser && chat" class="floating-chat mobile-hidden"></chat-panel>
<div v-if="isMobileLayout">
<side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
<div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
<notifications/>
</div>
</div>
<MobilePostStatusModal />
</div>
</template>

View file

@ -1,11 +1,13 @@
import SideDrawer from '../side_drawer/side_drawer.vue'
import Notifications from '../notifications/notifications.vue'
import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue'
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
const MobileNav = {
components: {
SideDrawer,
Notifications
Notifications,
MobilePostStatusModal
},
data: () => ({
notificationsOpen: false
@ -25,9 +27,19 @@ const MobileNav = {
},
toggleMobileNotifications () {
this.notificationsOpen = !this.notificationsOpen
if (!this.notificationsOpen) {
this.markNotificationsAsSeen()
}
},
scrollToTop () {
window.scrollTo(0, 0)
},
logout () {
this.$router.replace('/main/public')
this.$store.dispatch('logout')
},
markNotificationsAsSeen () {
this.$refs.notifications.markAsSeen()
}
}
}

View file

@ -1,6 +1,6 @@
<template>
<nav class='nav-bar container' @click="scrollToTop()" id="nav">
<div class='inner-nav'>
<nav class='nav-bar container asd' id="nav">
<div class='inner-nav mobile-inner-nav' @click="scrollToTop()" :class="{ 'shifted': notificationsOpen }">
<div class='item'>
<a href="#" class="menu-button" @click.stop.prevent="toggleMobileSidebar()">
<i class="button-icon icon-menu"></i>
@ -13,17 +13,102 @@
<div class="alert-dot" v-if="unseenNotificationsCount"></div>
</a>
</div>
<div class="mobile-notifications-header">
<span>Notifications</span>
<i class="icon-cancel" @click.stop.prevent="toggleMobileNotifications()"/>
</div>
</div>
<SideDrawer ref="sideDrawer" :logout="logout"/>
<div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
<Notifications/>
<Notifications ref="notifications" noHeading="true"/>
</div>
<MobilePostStatusModal />
</nav>
</template>
<script src="./mobile_nav.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.mobile-inner-nav {
transition: transform 0.25s;
&.shifted {
transform: translateX(-100%);
}
}
.mobile-notifications-header {
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 1.6em);
height: 100%;
margin: 0 0.8em 0 0.8em;
position: absolute;
font-size: 1.3em;
color: $fallback--text;
color: var(--text, $fallback--text);
top: 0;
left: 100%;
}
.menu-button {
position: relative;
}
.alert-dot {
border-radius: 100%;
height: 8px;
width: 8px;
position: absolute;
left: calc(50% - 4px);
top: calc(50% - 4px);
margin-left: 6px;
margin-top: -6px;
background-color: $fallback--cRed;
background-color: var(--badgeNotification, $fallback--cRed);
}
.mobile-notifications {
position: fixed;
width: 100vw;
height: calc(100vh - 50px);
top: 50px;
left: 0;
overflow-x: hidden;
overflow-y: scroll;
transition-property: transform;
transition-duration: 0.25s;
transform: translate(0);
color: $fallback--text;
color: var(--text, $fallback--text);
background-color: $fallback--bg;
background-color: var(--bg, $fallback--bg);
.notifications {
margin: 0;
padding: 0;
border-radius: 0;
box-shadow: none;
.panel {
border-radius: 0;
margin: 0;
box-shadow: none;
}
.panel:after {
border-radius: 0;
}
.panel .panel-heading {
border-radius: 0;
box-shadow: none;
}
}
&.closed {
transform: translate(100%);
}
}
</style>

View file

@ -7,6 +7,9 @@ import {
} from '../../services/notification_utils/notification_utils.js'
const Notifications = {
props: [
'noHeading'
],
created () {
const store = this.$store
const credentials = store.state.users.currentUser.credentials

View file

@ -1,7 +1,7 @@
<template>
<div class="notifications">
<div class="panel panel-default">
<div class="panel-heading">
<div v-if="!noHeading" class="panel-heading">
<div class="title">
{{$t('notifications.notifications')}}
<span class="badge badge-notification unseen-count" v-if="unseenCount">{{unseenCount}}</span>