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); onDestroy(unsubscribe);
let showForms = true; let showForms = true;
let showShiny = false;
let currentPlacement = 'boxPlacementForms'; let currentPlacement = 'boxPlacementForms';
let boxNumbers = []; let boxNumbers = Array<any>;
async function toggleForms() { async function toggleForms() {
showForms = !showForms; showForms = !showForms;
await getData(); await getData();
} }
async function toggleShiny() {
showShiny = !showShiny;
if (showShiny) {
showForms = false;
}
await getData();
}
async function getData() { async function getData() {
combinedData = null; combinedData = null;
@@ -66,6 +76,10 @@
{showForms ? 'Hide Forms' : 'Show Forms'} {showForms ? 'Hide Forms' : 'Show Forms'}
</button> </button>
<button class="btn" on:click={toggleShiny}>
{showShiny ? 'Hide Shiny' : 'Show Shiny'}
</button>
<div class="flex flex-wrap -mx-2"> <div class="flex flex-wrap -mx-2">
{#each boxNumbers as boxNumber} {#each boxNumbers as boxNumber}
<div class="mb-8 md:w-1/2 px-2"> <div class="mb-8 md:w-1/2 px-2">
@@ -82,6 +96,7 @@
pokemonName={pokedexEntry.pokemon} pokemonName={pokedexEntry.pokemon}
pokedexNumber={pokedexEntry.pokedexNumber} pokedexNumber={pokedexEntry.pokedexNumber}
form={pokedexEntry.form} form={pokedexEntry.form}
shiny={showShiny}
/> />
<!-- {pokedexEntry.form ? `(${pokedexEntry.form})` : ''} --> <!-- {pokedexEntry.form ? `(${pokedexEntry.form})` : ''} -->
<!-- <div class="font-bold"> <!-- <div class="font-bold">