-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Players.svelte
88 lines (81 loc) · 1.76 KB
/
_Players.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<script>
import Card from '$lib/components/Card.svelte';
import { players, nickname, isHost } from '../_store';
import { send } from '$lib/utils/api.js'
$: if ($players) {
console.log($players)
}
</script>
<div class="players">
<div class="hands">
{#each $players as player}
{#if player.nickname !== $nickname}
<div class="hand">
<div class="nickname">
{player.nickname}
{#if $isHost}
<button on:click={() => send('kick', { target: player.nickname })}>Kick</button>
{/if}
</div>
<div class="count">
{#each Array(Math.min(player.count, 9)) as _}
<Card color="black" symbol="" />
{/each}
<div class="layered-count">
{#each Array(player.count > 9 ? 9 : 0) as _}
<Card color="black" symbol="" />
{/each}
</div>
<div class="layered-count">
{#each Array(player.count > 18 ? 9 : 0) as _}
<Card color="black" symbol="" />
{/each}
</div>
</div>
</div>
{/if}
{/each}
</div>
</div>
<style lang="scss">
.players {
display: flex;
flex-direction: column;
overflow-y: auto;
flex: 1;
padding: 1rem;
.hands {
display: flex;
flex-direction: column;
grid-gap: 1.5rem;
.hand {
.nickname {
margin-bottom: 0.2rem;
display: flex;
grid-gap: 0.5rem;
button {
flex: 0;
font-size: 0.8rem;
padding: 0 0.2rem;
margin-bottom: 0.4rem;
}
}
.count {
position: relative;
margin-left: 0.5rem;
font-size: 1vw;
display: flex;
:global(.card) {
width: 1.6rem;
font-size: 0.3rem;
}
}
.layered-count {
position: absolute;
top: 0;
display: flex;
}
}
}
}
</style>