Fix nav highlighting

This commit is contained in:
Jon Staab
2024-10-11 16:11:11 -07:00
parent f5461d551e
commit aad1ad5f7c

View File

@@ -1,11 +1,14 @@
<script lang="ts">
import {page} from "$app/stores"
import Button from "@lib/components/Button.svelte"
import {getPrimaryNavItem} from '@app/routes'
export let title = ""
export let href = ""
$: active = href && $page.route?.id?.startsWith(href)
$: itemSegment = href.split('/')[1]
$: currentSegment = $page.route?.id?.split('/')[1]
$: active = itemSegment === currentSegment
</script>
{#if href}