Fix emoji picker bottom sheet

Padding and swipe gestures etc. Issue #65.
This commit is contained in:
N-Pex 2021-04-09 15:31:49 +02:00
parent dccf880547
commit 8c2ef10a1f
2 changed files with 52 additions and 26 deletions

View file

@ -259,7 +259,6 @@
</div>
<MessageOperationsBottomSheet ref="messageOperationsSheet" xv-show="showEmojiPicker">
<div>
<MessageOperationsPicker
v-on:close="showEmojiPicker = false"
v-if="selectedEvent"
@ -272,7 +271,6 @@
:event="selectedEvent"
/>
<VEmojiPicker ref="emojiPicker" style="width: 100%" @select="emojiSelected" />
</div>
</MessageOperationsBottomSheet>
<!-- "NOT ALLOWED FOR GUEST ACCOUNTS" dialog -->

View file

@ -1,13 +1,29 @@
<template>
<SwipeableBottomSheet
class="bottom-sheet"
ref="sheet"
:halfY="1"
:openY="0.4"
:data-closed="closed ? 1 : 0"
>
<slot></slot>
</SwipeableBottomSheet>
<div class="message-operations-bottom-sheet">
<v-fade-transition>
<div
v-show="!closed"
@click.stop="backgroundClick"
style="
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.3);
"
/>
</v-fade-transition>
<SwipeableBottomSheet
class="bottom-sheet ma-0 pa-0"
ref="sheet"
:halfY="0.5"
:openY="0.2"
:data-closed="closed ? 1 : 0"
>
<slot></slot>
</SwipeableBottomSheet>
</div>
</template>
<script>
@ -19,19 +35,13 @@ export default {
},
data() {
return {
closed: true
}
closed: true,
};
},
mounted() {
this.$watch(
"$refs.sheet.state",
(new_value, ignored_old_value) => {
this.closed = new_value == 'close';
if (new_value == 'half') {
this.$refs.sheet.setState("close");
}
}
);
this.$watch("$refs.sheet.state", (new_value, ignored_old_value) => {
this.closed = new_value == "close";
});
},
methods: {
open() {
@ -39,13 +49,21 @@ export default {
this.$refs.sheet.setState("close");
} else {
// Reset scroll before opening!
this.$refs.sheet.setState("open");
this.$refs.sheet.setState("half");
}
},
close() {
this.$refs.sheet.setState("close");
},
backgroundClick() {
if (this.$refs.sheet.state == "half") {
this.$refs.sheet.setState("close");
} else {
this.$refs.sheet.setState("half");
}
},
},
};
</script>
@ -57,13 +75,23 @@ export default {
so we use our own flag (data-closed) here to that we can
dim also when it is just half open */
.bottom-sheet[data-closed="0"] .bg {
display: block;
display: none;
transition: all 0.3s;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.3) !important;
background: transparent !important;
}
</style>
.message-operations-bottom-sheet {
.pan-area {
padding-bottom: 0px;
}
.card {
padding: 0px !important;
}
}
</style>