Merge branch 'develop' into feature/mobile-improvements-3
This commit is contained in:
commit
31010779f6
37 changed files with 630 additions and 316 deletions
|
@ -1,17 +1,16 @@
|
|||
import UserCard from '../user_card/user_card.vue'
|
||||
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
|
||||
|
||||
// TODO: separate touch gesture stuff into their own utils if more components want them
|
||||
const deltaCoord = (oldCoord, newCoord) => [newCoord[0] - oldCoord[0], newCoord[1] - oldCoord[1]]
|
||||
|
||||
const touchEventCoord = e => ([e.touches[0].screenX, e.touches[0].screenY])
|
||||
import GestureService from '../../services/gesture_service/gesture_service'
|
||||
|
||||
const SideDrawer = {
|
||||
props: [ 'logout' ],
|
||||
data: () => ({
|
||||
closed: true,
|
||||
touchCoord: [0, 0]
|
||||
closeGesture: undefined
|
||||
}),
|
||||
created () {
|
||||
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
|
||||
},
|
||||
components: { UserCard },
|
||||
computed: {
|
||||
currentUser () {
|
||||
|
@ -46,13 +45,10 @@ const SideDrawer = {
|
|||
this.toggleDrawer()
|
||||
},
|
||||
touchStart (e) {
|
||||
this.touchCoord = touchEventCoord(e)
|
||||
GestureService.beginSwipe(e, this.closeGesture)
|
||||
},
|
||||
touchMove (e) {
|
||||
const delta = deltaCoord(this.touchCoord, touchEventCoord(e))
|
||||
if (delta[0] < -30 && Math.abs(delta[1]) < Math.abs(delta[0]) && !this.closed) {
|
||||
this.toggleDrawer()
|
||||
}
|
||||
GestureService.updateSwipe(e, this.closeGesture)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="side-drawer-container"
|
||||
:class="{ 'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed }"
|
||||
>
|
||||
<div class="side-drawer-darken" :class="{ 'side-drawer-darken-closed': closed}" />
|
||||
<div class="side-drawer"
|
||||
:class="{'side-drawer-closed': closed}"
|
||||
@touchstart="touchStart"
|
||||
|
@ -106,16 +107,32 @@
|
|||
height: 100%;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
transition-duration: 0s;
|
||||
transition-property: transform;
|
||||
}
|
||||
|
||||
.side-drawer-container-open {
|
||||
transform: translate(0%);
|
||||
}
|
||||
|
||||
.side-drawer-container-closed {
|
||||
transition-delay: 0.35s;
|
||||
transform: translate(-100%);
|
||||
}
|
||||
|
||||
.side-drawer-darken {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
transition: 0.35s;
|
||||
transition-property: background-color;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.side-drawer-container-closed {
|
||||
left: -100%;
|
||||
.side-drawer-darken-closed {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -125,8 +142,9 @@
|
|||
|
||||
.side-drawer {
|
||||
overflow-x: hidden;
|
||||
transition: 0.35s;
|
||||
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
|
||||
transition: 0.35s;
|
||||
transition-property: transform;
|
||||
margin: 0 0 0 -100px;
|
||||
padding: 0 0 1em 100px;
|
||||
width: 80%;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue