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 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 >
You can’t perform that action at this time.
0 commit comments