Skip to content

Commit

Permalink
Account for if isActive is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
laurakwhit committed Sep 12, 2024
1 parent e581146 commit 79b803a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/holocene/navigation/navigation-item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
export let external = false;
export let animate = false;
export let disabled = false;
export let isActive: (path: string) => boolean = () => false;
export let isActive: (path: string) => boolean | undefined = undefined;
$: rel = external ? 'noopener noreferrer' : '';
$: target = external ? '_blank' : '';
$: active = isActive && isActive($page.url.href);
</script>

<div
Expand All @@ -32,7 +33,7 @@
aria-disabled={disabled}
class:disabled
tabindex={disabled ? -1 : 0}
class:active={isActive($page.url.href)}
class:active
class="mb-1 flex items-center whitespace-nowrap rounded-lg p-1 pl-2 text-sm font-medium"
class:text-disabled={disabled}
>
Expand Down

0 comments on commit 79b803a

Please sign in to comment.