fix(nav): use RouterEvents instead of page store for highlighting

dammit afn
This commit is contained in:
Ax333l 2022-12-27 13:57:39 +01:00
parent 715cb6a37d
commit 1881f6c903
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23

View File

@ -1,11 +1,11 @@
<script lang="ts">
import { page } from '$app/stores';
import RouterEvents from '$data/RouterEvents';
export let href: string;
</script>
<a data-sveltekit-preload-data {href}>
<!-- Check if href is equal to the first path -->
<li class:selected={href === '/' + $page.url.pathname.split('/')[1]}>
<li class:selected={href === '/' + $RouterEvents.target_url.pathname.split('/')[1]}>
<span><slot /></span>
</li>
</a>