Use global value to check for current Shop product

Also add other stores types to hint on expected values
This commit is contained in:
2022-06-22 23:20:52 +02:00
parent 255b00ab66
commit 6d4224abea
4 changed files with 21 additions and 10 deletions

View File

@@ -1,9 +1,9 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { getContext } from 'svelte'
import { shopCurrentProductSlug } from '$utils/stores/shop'
export let isOver: boolean = false
export let currentProductSlug: string = undefined
const { shopLocations } = getContext('shop')
@@ -29,7 +29,7 @@
</svg>
<select on:change={quickLocationChange}>
{#each shopLocations as { name, slug }}
<option value={slug} selected={slug === currentProductSlug}>{name}</option>
<option value={slug} selected={slug === $shopCurrentProductSlug}>{name}</option>
{/each}
</select>
</dd>

View File

@@ -127,6 +127,6 @@
class:is-visible={scrolledPastIntro}
class:is-overlaid={$cartOpen}
>
<ShopLocationSwitcher currentProductSlug={product && product.location.slug} />
<ShopLocationSwitcher />
<ButtonCart />
</nav>