Skip to content

Commit 80b6663

Browse files
committed
(UI) improve responsiveness
1 parent 896ef58 commit 80b6663

File tree

3 files changed

+50
-12
lines changed

3 files changed

+50
-12
lines changed

src/ChatWindow/EmojiPicker.vue

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
:style="{
2424
height: `${emojiPickerHeight}px`,
2525
top: positionTop ? emojiPickerHeight : `${emojiPickerTop}px`,
26-
right: positionTop ? '-50px' : positionRight ? '70px' : '',
26+
right: emojiPickerRight,
2727
display: emojiPickerTop || !emojiReaction ? 'initial' : 'none'
2828
}"
2929
>
@@ -72,7 +72,8 @@ export default {
7272
return {
7373
search: '',
7474
emojiPickerHeight: 320,
75-
emojiPickerTop: 0
75+
emojiPickerTop: 0,
76+
emojiPickerRight: ''
7677
}
7778
},
7879
methods: {
@@ -81,20 +82,33 @@ export default {
8182
},
8283
openEmoji(ev) {
8384
this.$emit('openEmoji', true)
84-
this.setEmojiPickerHeight(ev.clientY, ev.view.innerHeight)
85+
this.setEmojiPickerPosition(
86+
ev.clientY,
87+
ev.view.innerWidth,
88+
ev.view.innerHeight
89+
)
8590
},
86-
setEmojiPickerHeight(clientY, innerHeight) {
91+
setEmojiPickerPosition(clientY, innerWidth, innerHeight) {
8792
setTimeout(() => {
8893
if (!this.roomFooterRef) return
8994
90-
if (innerHeight < 700) this.emojiPickerHeight = 300
91-
95+
if (innerHeight < 700) this.emojiPickerHeight = innerHeight / 2
9296
const roomFooterTop = this.roomFooterRef.getBoundingClientRect().top
9397
const pickerTopPosition =
94-
roomFooterTop - clientY > this.emojiPickerHeight - 80
95-
96-
if (pickerTopPosition) this.emojiPickerTop = clientY
97-
else this.emojiPickerTop = clientY - this.emojiPickerHeight
98+
roomFooterTop - clientY > this.emojiPickerHeight - 50
99+
100+
if (pickerTopPosition) this.emojiPickerTop = clientY + 10
101+
else this.emojiPickerTop = clientY - this.emojiPickerHeight - 10
102+
103+
if (innerWidth < 500 && !this.positionRight) {
104+
this.emojiPickerRight = innerWidth / 5 + 'px'
105+
} else {
106+
this.emojiPickerRight = this.positionTop
107+
? '-50px'
108+
: this.positionRight
109+
? '60px'
110+
: ''
111+
}
98112
}, 0)
99113
}
100114
}

src/ChatWindow/Message.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,4 +803,22 @@ export default {
803803
background: var(--chat-message-bg-color-reaction-hover-me);
804804
}
805805
}
806+
807+
@media only screen and (max-width: 768px) {
808+
.message-container {
809+
padding: 3px;
810+
}
811+
812+
.message-box {
813+
flex: 0 0 80%;
814+
max-width: 80%;
815+
}
816+
.offset-current {
817+
margin-left: 20%;
818+
}
819+
820+
.options-container {
821+
right: 5px;
822+
}
823+
}
806824
</style>

src/ChatWindow/Room.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ export default {
664664
665665
.box-footer {
666666
display: flex;
667+
position: relative;
667668
background: var(--chat-footer-bg-color);
668669
padding: 10px 8px 10px;
669670
}
@@ -752,7 +753,7 @@ textarea {
752753
position: absolute;
753754
max-width: 20%;
754755
left: 16px;
755-
bottom: 18px;
756+
top: 18px;
756757
}
757758
758759
.image-file {
@@ -844,11 +845,16 @@ textarea {
844845
845846
.icon-textarea {
846847
margin: 6px 0 0 5px;
848+
849+
svg,
850+
.wrapper {
851+
margin: 0 5px;
852+
}
847853
}
848854
849855
.image-container {
856+
top: 10px;
850857
left: 10px;
851-
bottom: 10px;
852858
}
853859
854860
.room-footer {

0 commit comments

Comments
 (0)