feat(#22): Add shiny toggle

This commit is contained in:
Josh Creek
2024-07-16 21:47:57 +01:00
parent f62b18b0ee
commit 5bdf88b735
+16 -1
View File
@@ -20,14 +20,24 @@
onDestroy(unsubscribe);
let showForms = true;
let showShiny = false;
let currentPlacement = 'boxPlacementForms';
let boxNumbers = [];
let boxNumbers = Array<any>;
async function toggleForms() {
showForms = !showForms;
await getData();
}
async function toggleShiny() {
showShiny = !showShiny;
if (showShiny) {
showForms = false;
}
await getData();
}
async function getData() {
combinedData = null;
@@ -66,6 +76,10 @@
{showForms ? 'Hide Forms' : 'Show Forms'}
</button>
<button class="btn" on:click={toggleShiny}>
{showShiny ? 'Hide Shiny' : 'Show Shiny'}
</button>
<div class="flex flex-wrap -mx-2">
{#each boxNumbers as boxNumber}
<div class="mb-8 md:w-1/2 px-2">
@@ -82,6 +96,7 @@
pokemonName={pokedexEntry.pokemon}
pokedexNumber={pokedexEntry.pokedexNumber}
form={pokedexEntry.form}
shiny={showShiny}
/>
<!-- {pokedexEntry.form ? `(${pokedexEntry.form})` : ''} -->
<!-- <div class="font-bold">