Fix nav highlighting
This commit is contained in:
parent
f5461d551e
commit
aad1ad5f7c
1 changed files with 4 additions and 1 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
|
import {getPrimaryNavItem} from '@app/routes'
|
||||||
|
|
||||||
export let title = ""
|
export let title = ""
|
||||||
export let href = ""
|
export let href = ""
|
||||||
|
|
||||||
$: active = href && $page.route?.id?.startsWith(href)
|
$: itemSegment = href.split('/')[1]
|
||||||
|
$: currentSegment = $page.route?.id?.split('/')[1]
|
||||||
|
$: active = itemSegment === currentSegment
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if href}
|
{#if href}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue