File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
import SnsBar from ' ./SnsBar.svelte' ;
3
3
import { page } from ' $app/stores' ;
4
4
import { base as baseUrl } from ' $app/paths' ;
5
+
6
+ function isActive (pathname , path ) {
7
+ return pathname === path || pathname === ` ${ baseUrl}${ path} ` ;
8
+ }
5
9
</script >
6
10
7
11
<header class =" header" >
8
12
<span class =" title" >svelte-eslint-parser</span >
9
13
<a
10
14
class =" menu"
11
- class:active ={$page .url .pathname === ` ${ baseUrl }/ ` }
15
+ class:active ={isActive ( $page .url .pathname , ` / ` ) }
12
16
sveltekit:prefetch
13
17
href =" {baseUrl }/" >AST</a
14
18
>
15
19
<a
16
20
class =" menu"
17
- class:active ={$page .url .pathname === ` ${ baseUrl } /playground` }
21
+ class:active ={isActive ( $page .url .pathname , ` /playground ` ) }
18
22
sveltekit:prefetch
19
23
href =" {baseUrl }/playground" >Playgroud</a
20
24
>
21
25
<a
22
26
class =" menu"
23
- class:active ={$page .url .pathname === ` ${ baseUrl } /scope` }
27
+ class:active ={isActive ( $page .url .pathname , ` /scope ` ) }
24
28
sveltekit:prefetch
25
29
href =" {baseUrl }/scope" >Scope</a
26
30
>
You can’t perform that action at this time.
0 commit comments