radames's picture
switch rooms api
bc15a99
raw
history blame
933 Bytes
<script lang="ts">
import { onMount, createEventDispatcher } from 'svelte';
import PPButton from '$lib/Buttons/PPButton.svelte';
import RoomsSelector from '$lib/Buttons/RoomsSelector.svelte';
import LiveBlocks from '$lib/Icons/LiveBlocks.svelte';
const dispatch = createEventDispatcher();
export let isLoading = false;
const onKeyup = (e: KeyboardEvent) => {
if (e.key === 'Enter') {
dispatch('prompt');
}
};
onMount(() => {
window.addEventListener('keyup', onKeyup);
return () => {
window.removeEventListener('keyup', onKeyup);
};
});
</script>
<div class="grid grid-cols-1 gap-1 w-max mx-auto place-items-center">
<PPButton {isLoading} on:click={() => dispatch('prompt')} />
<RoomsSelector {isLoading} />
<a
href="https://liveblocks.io"
target="_blank"
rel="noopener noreferrer"
title="Multiplayer backend by LiveBlocks.io"
>
<LiveBlocks classList="max-h-8 md:max-h-fit" />
</a>
</div>