fix: layout doesn't refer to url

This commit is contained in:
Tomáš Mládek 2024-02-27 13:07:06 +01:00
parent fd25154725
commit 7e29468247
3 changed files with 16 additions and 2 deletions

View file

@ -20,11 +20,11 @@
}); });
}); });
$: onlyCard = $page.url.pathname === '/card'; $: onlyCard = $page.data.card;
</script> </script>
<TestCard full={onlyCard} on:focus={() => goto('/card')} /> <TestCard full={onlyCard} on:focus={() => goto('/card')} />
<main class:content={!onlyCard} class:sub={$page.url.pathname !== '/' && !onlyCard}> <main class:content={!onlyCard} class:sub={!$page.data.root && !onlyCard}>
<a href=".." class="button button-back"><i class="ti ti-arrow-back" />Back</a> <a href=".." class="button button-back"><i class="ti ti-arrow-back" />Back</a>
<slot /> <slot />
</main> </main>

7
src/routes/+page.ts Normal file
View file

@ -0,0 +1,7 @@
import type { PageLoad } from './$types';
export const load: PageLoad = () => {
return {
root: true
}
}

7
src/routes/card/+page.ts Normal file
View file

@ -0,0 +1,7 @@
import type { PageLoad } from './$types';
export const load: PageLoad = () => {
return {
card: true
};
};