Skip to content

Commit

Permalink
default to select by country
Browse files Browse the repository at this point in the history
  • Loading branch information
nichady committed Feb 25, 2024
1 parent 3b78bab commit 3dc3d83
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions web/src/page/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
name: `${getEmojiFlag(id)} ${country.name}`,
}));
let selectByCountry = false;
let selectByContinent = false;
let selectedTimes = [];
let selectedFlavors = [];
Expand All @@ -35,9 +35,7 @@
$: valid =
selectedTimes.length > 0 &&
selectedFlavors.length > 0 &&
(selectByCountry
? selectedCountries.length > 0
: selectedContinents.length > 0);
(selectByContinent ? selectedContinents.length > 0 : selectedCountries.length > 0);
let includeIngredients;
let excludeIngredients;
Expand All @@ -54,9 +52,7 @@
Flavors: selectedFlavors,
InludeIngredients: includeIngredients,
ExcludeIngredients: excludeIngredients,
Locations: selectByCountry
? selectedCountries
: selectedContinents,
Locations: selectByContinent ? selectedContinents : selectedCountries,
}),
});
Expand Down Expand Up @@ -107,7 +103,7 @@

<div class="flex">
<h5>Which types of cuisine do you want?</h5>
{#if !selectByCountry}
{#if selectByContinent}
<Svelecte
placeholder="Select continents"
options={continents}
Expand All @@ -125,8 +121,8 @@
></Svelecte>
{/if}
<label>
<input type="checkbox" role="switch" bind:checked={selectByCountry} />
Select by country instead
<input type="checkbox" role="switch" bind:checked={selectByContinent} />
Select by continent instead
</label>
</div>

Expand Down

0 comments on commit 3dc3d83

Please sign in to comment.