Skip to content

Commit a18bd1f

Browse files
committed
(UI) improve footer input
1 parent 5bbeed4 commit a18bd1f

File tree

3 files changed

+56
-18
lines changed

3 files changed

+56
-18
lines changed

src/ChatWindow/ChatMessage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
:style="{ background: `url(${message.file.url})` }"
6363
>
6464
<transition name="fade-image">
65-
<div class="image-buttons" v-if="imageHover">
65+
<div class="image-buttons" v-if="imageHover && !isImageLoading">
6666
<div
6767
class="svg-button button-view"
6868
@click.stop="openFile(message.file)"

src/ChatWindow/MessagesList.vue

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@
9595
</transition>
9696

9797
<div class="box-footer">
98-
<div v-if="imageFile">
98+
<div class="image-container" v-if="imageFile">
9999
<div class="svg-button icon-image" @click="resetImageFile">
100100
<svg-icon name="close" param="image" />
101101
</div>
102102
<div class="image-file">
103-
<img :src="imageFile" />
103+
<img ref="imageFile" :src="imageFile" />
104104
</div>
105105
</div>
106106

@@ -118,7 +118,15 @@
118118
v-show="!file || imageFile"
119119
ref="roomTextarea"
120120
:placeholder="textMessages.TYPE_MESSAGE"
121-
:class="{ 'textarea-outline': editedMessage._id }"
121+
:class="{
122+
'textarea-outline': editedMessage._id,
123+
'textarea-image': imageFile
124+
}"
125+
:style="{
126+
height: `${imageDimensions.height}px`,
127+
'min-height': `${imageDimensions.height - 14}px`,
128+
'padding-left': `${imageDimensions.width}px`
129+
}"
122130
v-model="message"
123131
@input="autoGrow"
124132
@keydown.esc="resetMessage"
@@ -209,6 +217,7 @@ export default {
209217
loadingMessages: false,
210218
file: null,
211219
imageFile: null,
220+
imageDimensions: { height: '32px', width: '10px' },
212221
menuOpened: false,
213222
emojiOpened: false,
214223
scrollIcon: false
@@ -259,6 +268,17 @@ export default {
259268
messagesLoaded(val) {
260269
if (val) this.loadingMessages = false
261270
if (this.infiniteState) this.infiniteState.complete()
271+
},
272+
imageFile() {
273+
setTimeout(() => {
274+
if (!this.$refs.imageFile)
275+
return (this.imageDimensions = { height: 32, width: 10 })
276+
277+
this.imageDimensions = {
278+
height: this.$refs.imageFile.height + 2,
279+
width: this.$refs.imageFile.width + 20
280+
}
281+
}, 20)
262282
}
263283
},
264284
@@ -439,7 +459,7 @@ export default {
439459
440460
.container-scroll {
441461
background: var(--chat-content-bg-color);
442-
height: calc(100% - 120px);
462+
height: calc(100% - 110px);
443463
overflow-y: auto;
444464
margin-right: 1px;
445465
}
@@ -486,7 +506,7 @@ export default {
486506
.box-footer {
487507
display: flex;
488508
background: var(--chat-footer-bg-color);
489-
padding: 8px;
509+
padding: 0 8px 8px;
490510
491511
* {
492512
z-index: 1;
@@ -495,8 +515,8 @@ export default {
495515
496516
.reply-container {
497517
display: flex;
498-
padding: 10px 10px 0;
499-
background: var(--chat-footer-bg-color);
518+
padding: 10px 10px 10px;
519+
background: var(--chat-content-bg-color);
500520
z-index: -1;
501521
align-items: center;
502522
max-width: 100%;
@@ -540,15 +560,14 @@ textarea {
540560
background: var(--chat-bg-color-input);
541561
color: var(--chat-color);
542562
border-radius: 20px;
543-
margin: 2px;
544-
padding: 12px 15px 0 10px;
563+
padding: 12px 140px 0 10px;
545564
overflow: hidden;
546565
outline: 0;
547566
width: 100%;
548567
resize: none;
549568
height: 32px;
550569
caret-color: var(--chat-color-caret);
551-
border: none;
570+
border: var(--chat-border-style-input);
552571
font-size: 16px;
553572
554573
&::placeholder {
@@ -557,10 +576,16 @@ textarea {
557576
}
558577
559578
.textarea-outline {
560-
box-shadow: inset 0px 0px 0px 1px var(--chat-border-color-input-selected);
579+
border: 1px solid var(--chat-border-color-input-selected);
580+
}
581+
582+
.textarea-image {
583+
padding-left: 200px;
561584
}
562585
563586
.icon-textarea {
587+
position: absolute;
588+
right: 20px;
564589
display: flex;
565590
margin: 12px 0 0 5px;
566591
@@ -570,20 +595,27 @@ textarea {
570595
}
571596
}
572597
598+
.image-container {
599+
position: absolute;
600+
left: 16px;
601+
bottom: 15px;
602+
z-index: 2;
603+
}
604+
573605
.image-file {
574606
display: flex;
575-
margin-right: 10px;
576607
577608
img {
609+
border-radius: 20px;
578610
max-width: 250px;
579611
max-height: 100%;
580612
}
581613
}
582614
583615
.icon-image {
584616
position: absolute;
585-
top: 15px;
586-
left: 15px;
617+
top: 10px;
618+
left: 10px;
587619
z-index: 2;
588620
589621
svg {
@@ -599,7 +631,10 @@ textarea {
599631
display: flex;
600632
align-items: center;
601633
width: 100%;
602-
height: 48px;
634+
height: 44px;
635+
background: var(--chat-bg-color-input);
636+
border: var(--chat-border-style-input);
637+
border-radius: 20px;
603638
}
604639
605640
.icon-file {

src/themes/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const defaultThemeColors = {
1515
},
1616

1717
footer: {
18-
background: '#f0f0f0',
18+
background: 'none',
19+
borderStyleInput: '1px solid #e1e4e8',
1920
borderInputSelected: '#1976d2',
2021
backgroundReply: 'rgba(0, 0, 0, 0.08)'
2122
},
@@ -100,7 +101,8 @@ export const defaultThemeColors = {
100101
},
101102

102103
footer: {
103-
background: '#131415',
104+
background: 'none',
105+
borderStyleInput: 'none',
104106
borderInputSelected: '#1976d2',
105107
backgroundReply: '#1b1c1c'
106108
},
@@ -198,6 +200,7 @@ export const cssThemeVars = ({
198200

199201
// footer
200202
'--chat-footer-bg-color': footer.background,
203+
'--chat-border-style-input': footer.borderStyleInput,
201204
'--chat-border-color-input-selected': footer.borderInputSelected,
202205
'--chat-footer-bg-color-reply': footer.backgroundReply,
203206

0 commit comments

Comments
 (0)