mirror of
https://github.com/revanced/revanced-website.git
synced 2025-04-29 22:24:31 +02:00
feat: prefetching and instant page switching
This commit is contained in:
parent
9b97f062c6
commit
ea599f2397
@ -1,10 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page, navigating } from '$app/stores';
|
||||||
export let href = '/';
|
export let href = '/';
|
||||||
$: current = href === $page.url.pathname;
|
let nav = null;
|
||||||
|
|
||||||
|
$: current_page = $page.url.pathname;
|
||||||
|
$: {
|
||||||
|
nav = $navigating;
|
||||||
|
if (nav != null && nav.to != null) {
|
||||||
|
current_page = nav.to.url.pathname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$: current = href === current_page;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a {href}>
|
<a data-sveltekit-prefetch {href}>
|
||||||
<li class:selected={current === true}>
|
<li class:selected={current === true}>
|
||||||
<slot />
|
<slot />
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user