1313 </div >
1414 <div class =" chatbox_input flex-col w-full absolute bottom-2" >
1515 <div class =" w-full" >
16- <div
17- class =" gif-container h-[400px] flex z-10 w-[400px] mt-64 overflow-y-scroll"
18- >
16+ <div class =" gif-container h-[400px] flex z-10 w-[400px] mt-64 overflow-y-scroll" >
1917 <div class =" flex flex-wrap justify-center" >
2018 <img
2119 v-for =" gif in gifs"
2725 />
2826 </div >
2927 </div >
28+ <div
29+ ref =" emojiContainer"
30+ v-if =" showEmoji"
31+ class =" place-items-start ease-in-out transition-all duration-300"
32+ onfocusout =" showEmoji()"
33+ >
34+ <EmojiPicker :native =" true " class="!mr-0 !ml-0" @select =" (event ) => addEmoji (event ) " />
35+ </div >
36+ <button class =" emojiBtn w-1/12 h-1/12" @click =" displayEmoji()" ref =" emojiBtn" >😄</button >
3037 <input
3138 v-model =" newMessageText"
3239 @keydown.enter =" sendMessage"
3340 placeholder =" Envoyer un message"
3441 :class =" {
35- 'w-9 /12': !gifSelected,
42+ 'w-8 /12': !gifSelected,
3643 'w-3/12': gifSelected,
3744 'p-2': true,
3845 'bg-white': true,
5865 placeholder =" Gif"
5966 :class =" {
6067 'w-3/12': !gifSelected,
61- 'w-9 /12': gifSelected,
68+ 'w-8 /12': gifSelected,
6269 'p-2': true,
6370 'bg-white': true,
6471 'dark:bg-gray-700': true,
@@ -90,6 +97,8 @@ import axios, { AxiosError } from 'axios';
9097import { manager } from ' @/api/network/socket.io' ;
9198import { http } from ' @/api/network/axios' ;
9299import { withErrorHandler } from ' @/utils/storeHandler' ;
100+ import EmojiPicker from ' vue3-emoji-picker' ;
101+ import ' vue3-emoji-picker/css' ;
93102
94103const props = defineProps <{
95104 roomId: string ;
@@ -105,9 +114,10 @@ const gifs = ref([]);
105114const newMessageText = ref (' ' );
106115const courseId = ref ();
107116const count = ref ();
108- const hoverHint = ref (false );
109117const gifSelected = ref (false );
110118const searchTimeout = ref (null );
119+ const showEmoji = ref (false );
120+ const emojiContainer = ref ();
111121
112122/* SOCKET */
113123
@@ -133,6 +143,15 @@ onUnmounted(() => {
133143
134144/* METHODS */
135145
146+ const addEmoji = (selection ) => {
147+ console .log (selection .i );
148+ newMessageText .value += selection .i ;
149+ };
150+
151+ const displayEmoji = () => {
152+ showEmoji .value = ! showEmoji .value ;
153+ };
154+
136155const addMessage = (msg : Object ) => {
137156 messages .value .unshift (msg );
138157};
0 commit comments