Merge branch 'twemojiEmoteMenuSvelte' of github.com:thecodingmachine/workadventure into twemojiEmoteMenuSvelte

This commit is contained in:
Lurkars 2021-09-16 18:20:42 +02:00
parent 7922de10ff
commit 63c4eeb4c7
2 changed files with 21 additions and 2 deletions

View File

@ -4,6 +4,7 @@
import { emoteStore, emoteMenuStore } from "../../Stores/EmoteStore"; import { emoteStore, emoteMenuStore } from "../../Stores/EmoteStore";
import { onDestroy, onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
import { EmojiButton } from '@joeattardi/emoji-button'; import { EmojiButton } from '@joeattardi/emoji-button';
import { isMobile } from "../../Enum/EnvironmentVariable";
let emojiContainer: HTMLElement; let emojiContainer: HTMLElement;
let picker: EmojiButton; let picker: EmojiButton;
@ -16,6 +17,7 @@
styleProperties: { styleProperties: {
'--font': 'Press Start 2P' '--font': 'Press Start 2P'
}, },
emojisPerRow: isMobile() ? 6 : 8,
autoFocusSearch: false autoFocusSearch: false
}); });
@ -36,6 +38,12 @@
}) })
}) })
function onKeyDown(e:KeyboardEvent) {
if (e.key === 'Escape') {
emoteMenuStore.closeEmoteMenu();
}
}
onDestroy(() => { onDestroy(() => {
if (unsubscriber) { if (unsubscriber) {
unsubscriber(); unsubscriber();
@ -46,6 +54,8 @@
</script> </script>
<svelte:window on:keydown={onKeyDown}/>
<div class="emote-menu-container"> <div class="emote-menu-container">
<div class="emote-menu" bind:this={emojiContainer}></div> <div class="emote-menu" bind:this={emojiContainer}></div>
</div> </div>

View File

@ -1106,3 +1106,12 @@ div.is-silent.hide {
.emote-menu .emoji-picker .emoji-picker__emoji { .emote-menu .emoji-picker .emoji-picker__emoji {
font-family: "Twemoji Mozilla" !important; font-family: "Twemoji Mozilla" !important;
} }
div.emoji-picker {
background-color: #333;
border-radius: 1em;
input.emoji-picker__search {
border-radius: 1em;
}
}