data types and base fen before implementation
This commit is contained in:
parent
4f221ea7a8
commit
a56e77c378
2 changed files with 40 additions and 40 deletions
|
|
@ -1,8 +1,9 @@
|
|||
<script lang="ts">
|
||||
import { Board } from "$lib/chess/utils";
|
||||
import { Board, startFEN } from "$lib/chess/utils";
|
||||
|
||||
const board = new Board();
|
||||
let showIndex = $state(false);
|
||||
let fen = $state(startFEN);
|
||||
</script>
|
||||
|
||||
<div class="grid grid-cols-8 gap-0 border-2">
|
||||
|
|
@ -10,14 +11,18 @@
|
|||
<div class="h-20 aspect-square flex justify-center items-center
|
||||
{index % 2 === Math.floor(index / 8) % 2 ? 'bg-orange-200 text-stone-800' : 'bg-amber-800 text-stone-200'}
|
||||
">
|
||||
{#if square}<img src="assets/{square}.svg" alt="{square}" class="h-16 aspect-square"/>{/if}
|
||||
{#if square}<img src="assets/{square}.svg" alt="p{square}" class="h-16 aspect-square"/>{/if}
|
||||
{showIndex ? index : ''}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<div>
|
||||
<label>
|
||||
<label class="block">
|
||||
show index
|
||||
<input type="checkbox" bind:checked={showIndex} />
|
||||
</label>
|
||||
<label class="block">
|
||||
fen:
|
||||
<input type="text" onkeypress={(e) => e.key === 'Enter' && board.loadFEN(fen)} bind:value={fen} />
|
||||
</label>
|
||||
</div>
|
||||
Loading…
Reference in a new issue