Use improved bottom sheet for room info as well
This one allows all of the content to be scrollable/viewed even if the sheet is only half open.
This commit is contained in:
parent
b21b0b04a5
commit
9aa49094bc
2 changed files with 10 additions and 45 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
:style="{ top: `${isMove ? y : calcY()}px` }"
|
:style="{ top: `${isMove ? y : calcY()}px` }"
|
||||||
>
|
>
|
||||||
<div class="bottom-sheet-handle"><div class="bottom-sheet-handle-decoration" /></div>
|
<div class="bottom-sheet-handle"><div class="bottom-sheet-handle-decoration" /></div>
|
||||||
<div style="position:absolute;top:20px;left:0;right:0;bottom:0;overflow-y:auto">
|
<div style="position:absolute;top:20px;left:0;right:0;bottom:0;overflow-y:auto;padding:20px">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -140,6 +140,7 @@ export default {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-sheet-bg {
|
.bottom-sheet-bg {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<SwipeableBottomSheet
|
<BottomSheet
|
||||||
class="bottom-sheet"
|
class="room-info-bottom-sheet"
|
||||||
ref="roomInfoSheet"
|
ref="sheet"
|
||||||
:halfY="0.5"
|
|
||||||
:openY="0.1"
|
|
||||||
:data-closed="closed ? 1 : 0"
|
|
||||||
>
|
>
|
||||||
<div class="room-info-sheet" ref="roomInfoSheetContent">
|
<div class="room-info-sheet" ref="roomInfoSheetContent">
|
||||||
<div class="text-center current-room">
|
<div class="text-center current-room">
|
||||||
|
|
@ -33,11 +30,11 @@
|
||||||
>Create group</v-btn
|
>Create group</v-btn
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</SwipeableBottomSheet>
|
</BottomSheet>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import SwipeableBottomSheet from "vue-swipeable-bottom-sheet/src/components/SwipeableBottomSheet";
|
import BottomSheet from "./BottomSheet";
|
||||||
import RoomList from "./RoomList.vue";
|
import RoomList from "./RoomList.vue";
|
||||||
import roomInfoMixin from "./roomInfoMixin";
|
import roomInfoMixin from "./roomInfoMixin";
|
||||||
|
|
||||||
|
|
@ -45,35 +42,16 @@ export default {
|
||||||
name: "RoomInfoBottomSheet",
|
name: "RoomInfoBottomSheet",
|
||||||
mixins: [roomInfoMixin],
|
mixins: [roomInfoMixin],
|
||||||
components: {
|
components: {
|
||||||
SwipeableBottomSheet,
|
BottomSheet,
|
||||||
RoomList,
|
RoomList,
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
closed: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$watch(
|
|
||||||
"$refs.roomInfoSheet.state",
|
|
||||||
(new_value, ignored_old_value) => {
|
|
||||||
this.closed = new_value == 'close';
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
if (this.$refs.roomInfoSheet.state == "half") {
|
this.$refs.sheet.open();
|
||||||
this.$refs.roomInfoSheet.setState("close");
|
|
||||||
} else {
|
|
||||||
// Reset scroll before opening!
|
|
||||||
this.$refs.roomInfoSheetContent.parentElement.scrollTop = 0;
|
|
||||||
this.$refs.roomInfoSheet.setState("half");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.$refs.roomInfoSheet.setState("close");
|
this.$refs.sheet.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
showDetails() {
|
showDetails() {
|
||||||
|
|
@ -92,18 +70,4 @@ export default {
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@/assets/css/chat.scss";
|
@import "@/assets/css/chat.scss";
|
||||||
|
|
||||||
/* Default implementation only dims background when fully open,
|
|
||||||
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;
|
|
||||||
transition: all 0.3s;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.3) !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue