feat(join): add leave room button when there is no opponent yet

This commit is contained in:
Yael Arturo Chavoya Andalón
2024-09-30 16:36:04 -06:00
committed by Sparsh Goenka
parent e285fa4801
commit 0b5f513520
2 changed files with 17 additions and 6 deletions

View File

@@ -7,11 +7,13 @@
class: className = '',
roomCode,
createRoom,
joinRoom
joinRoom,
leaveRoom
}: {
roomCode: string;
createRoom: () => void;
joinRoom: (code: string) => void;
leaveRoom: () => void;
class: string;
} = $props();
</script>
@@ -41,8 +43,8 @@
Create Room
</button>
{/if}
<div class="text-center text-lg text-primary-content">OR</div>
{#if !roomCode}
<div class="text-center text-lg text-primary-content">OR</div>
<div class="space-y-2">
<input
type="text"
@@ -58,6 +60,12 @@
Join Room
</button>
</div>
{:else}
<div class="space-x-2 flex flex-row justify-center items-center">
<button class="btn btn-error text-2xl" onclick={leaveRoom}>
Leave room
</button>
</div>
{/if}
</div>
</div>