Skip to content

Commit 550ad6d

Browse files
committed
fix site
1 parent 8d538b3 commit 550ad6d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

explorer-v2/src/lib/Header.svelte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@
22
import SnsBar from './SnsBar.svelte';
33
import { page } from '$app/stores';
44
import { base as baseUrl } from '$app/paths';
5+
6+
function isActive(pathname, path) {
7+
return pathname === path || pathname === `${baseUrl}${path}`;
8+
}
59
</script>
610

711
<header class="header">
812
<span class="title">svelte-eslint-parser</span>
913
<a
1014
class="menu"
11-
class:active={$page.url.pathname === `${baseUrl}/`}
15+
class:active={isActive($page.url.pathname, `/`)}
1216
sveltekit:prefetch
1317
href="{baseUrl}/">AST</a
1418
>
1519
<a
1620
class="menu"
17-
class:active={$page.url.pathname === `${baseUrl}/playground`}
21+
class:active={isActive($page.url.pathname, `/playground`)}
1822
sveltekit:prefetch
1923
href="{baseUrl}/playground">Playgroud</a
2024
>
2125
<a
2226
class="menu"
23-
class:active={$page.url.pathname === `${baseUrl}/scope`}
27+
class:active={isActive($page.url.pathname, `/scope`)}
2428
sveltekit:prefetch
2529
href="{baseUrl}/scope">Scope</a
2630
>

0 commit comments

Comments
 (0)