21
21
class =" emoji-picker"
22
22
:class =" { 'picker-reaction': emojiReaction }"
23
23
:style =" {
24
- top: `${emojiPickerHeight}px`,
25
- right: positionRight ? '85px' : '',
26
- display: emojiPickerHeight || !emojiReaction ? 'initial' : 'none'
24
+ height: `${emojiPickerHeight}px`,
25
+ top: positionTop ? emojiPickerHeight : `${emojiPickerTop}px`,
26
+ right: positionTop ? '-50px' : positionRight ? '70px' : '',
27
+ display: emojiPickerTop || !emojiReaction ? 'initial' : 'none'
27
28
}"
28
29
>
29
30
<div class =" emoji-picker__search" >
@@ -60,11 +61,18 @@ export default {
60
61
EmojiPicker,
61
62
SvgIcon
62
63
},
63
- props: [' emojiOpened' , ' emojiReaction' , ' roomFooterRef' , ' positionRight' ],
64
+ props: [
65
+ ' emojiOpened' ,
66
+ ' emojiReaction' ,
67
+ ' roomFooterRef' ,
68
+ ' positionTop' ,
69
+ ' positionRight'
70
+ ],
64
71
data () {
65
72
return {
66
73
search: ' ' ,
67
- emojiPickerHeight: ' '
74
+ emojiPickerHeight: 320 ,
75
+ emojiPickerTop: 0
68
76
}
69
77
},
70
78
methods: {
@@ -73,17 +81,20 @@ export default {
73
81
},
74
82
openEmoji (ev ) {
75
83
this .$emit (' openEmoji' , true )
76
- this .setEmojiPickerHeight (ev .clientY )
84
+ this .setEmojiPickerHeight (ev .clientY , ev . view . innerHeight )
77
85
},
78
- setEmojiPickerHeight (clientY ) {
86
+ setEmojiPickerHeight (clientY , innerHeight ) {
79
87
setTimeout (() => {
80
88
if (! this .roomFooterRef ) return
81
89
90
+ if (innerHeight < 700 ) this .emojiPickerHeight = 300
91
+
82
92
const roomFooterTop = this .roomFooterRef .getBoundingClientRect ().top
83
- const pickerTopPosition = roomFooterTop - clientY > 320
93
+ const pickerTopPosition =
94
+ roomFooterTop - clientY > this .emojiPickerHeight - 80
84
95
85
- if (pickerTopPosition) this .emojiPickerHeight = clientY
86
- else this .emojiPickerHeight = clientY - 320
96
+ if (pickerTopPosition) this .emojiPickerTop = clientY
97
+ else this .emojiPickerTop = clientY - this . emojiPickerHeight
87
98
}, 0 )
88
99
}
89
100
}
@@ -96,23 +107,13 @@ export default {
96
107
display : flex ;
97
108
}
98
109
99
- .regular-input {
100
- padding : 0.5rem 1rem ;
101
- border-radius : 3px ;
102
- border : var (--chat-border-style );
103
- width : 20rem ;
104
- height : 12rem ;
105
- outline : none ;
106
- }
107
-
108
110
.emoji-picker {
109
111
position : absolute ;
110
112
z-index : 9999 ;
111
113
bottom : 32px ;
112
114
right : 10px ;
113
115
border : var (--chat-border-style );
114
- width : 15rem ;
115
- height : 20rem ;
116
+ width : 240px ;
116
117
overflow : scroll ;
117
118
padding : 1rem ;
118
119
box-sizing : border-box ;
0 commit comments