Fix current product detection on Shop location switcher select
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores'
|
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { getContext } from 'svelte'
|
import { getContext } from 'svelte'
|
||||||
|
|
||||||
export let isOver: boolean = false
|
export let isOver: boolean = false
|
||||||
|
export let currentProductSlug: string = undefined
|
||||||
|
|
||||||
const { shopLocations } = getContext('shop')
|
const { shopLocations } = getContext('shop')
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
<select on:change={quickLocationChange}>
|
<select on:change={quickLocationChange}>
|
||||||
{#each shopLocations as { name, slug }}
|
{#each shopLocations as { name, slug }}
|
||||||
<option value={slug} selected={slug === $page.params.name}>{name}</option>
|
<option value={slug} selected={slug === currentProductSlug}>{name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -128,6 +128,6 @@
|
|||||||
class:is-visible={scrolledPastIntro}
|
class:is-visible={scrolledPastIntro}
|
||||||
class:is-overlaid={$cartOpen}
|
class:is-overlaid={$cartOpen}
|
||||||
>
|
>
|
||||||
<ShopLocationSwitcher />
|
<ShopLocationSwitcher currentProductSlug={product && product.location.slug} />
|
||||||
<ButtonCart />
|
<ButtonCart />
|
||||||
</nav>
|
</nav>
|
||||||
Reference in New Issue
Block a user