swaf/views/home.svelte

58 lines
922 B
Svelte
Raw Normal View History

2021-03-24 16:07:50 +01:00
<script>
import HomeDep from "./home_dep.svelte";
import Layout from "./layout.svelte";
2021-03-18 16:22:25 +01:00
export let swaf = {};
2021-03-24 16:07:50 +01:00
let count = 5;
2021-03-18 16:22:25 +01:00
2021-03-24 16:07:50 +01:00
function handleClick() {
2021-03-18 16:22:25 +01:00
count++;
}
2021-03-24 16:07:50 +01:00
let depTest;
2021-03-18 16:22:25 +01:00
</script>
<style lang="scss">
2021-03-24 16:07:50 +01:00
p:last-of-type {
color: blueviolet;
}
.style-test {
p {
color: blue;
}
}
2021-03-18 16:22:25 +01:00
</style>
<Layout title="Home">
<svelte:fragment slot="body">
<h1>BONJOUR lol</h1>
</svelte:fragment>
</Layout>
2021-03-24 16:07:50 +01:00
2021-03-18 16:22:25 +01:00
<h1>Hello {count}!</h1>
<button on:click={handleClick}>More hellos!!</button>
2021-03-24 16:07:50 +01:00
<p>Direct access: {swaf.direct}</p>
2021-03-18 16:22:25 +01:00
{#if swaf.route('auth') === '/'}
We're home!
{:else}
We're somewhere else... {swaf.route('auth')}
{/if}
<p>The route to auth is {swaf.route('auth')}</p>
2021-03-24 16:07:50 +01:00
<p>\swaf.notcode</p>
2021-03-18 16:22:25 +01:00
2021-03-24 16:07:50 +01:00
<p>{`{\\swaf.escaped}`}</p>
2021-03-18 16:22:25 +01:00
<div class="style-test">
<p>Blue!</p>
</div>
2021-03-24 16:07:50 +01:00
<HomeDep swaf={swaf} bind:depTest={depTest}/>
<p>Dependency test: {depTest}</p>