-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add something to do on updated-store tutorial (#544)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
- Loading branch information
1 parent
7eac90f
commit 3c3af89
Showing
3 changed files
with
98 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
content/tutorial/03-sveltekit/08-stores/03-updated-store/app-b/src/routes/+layout.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script> | ||
import { page, navigating, updated } from '$app/stores'; | ||
</script> | ||
|
||
<nav> | ||
<a href="/" aria-current={$page.url.pathname === '/'}> | ||
home | ||
</a> | ||
|
||
<a href="/about" aria-current={$page.url.pathname === '/about'}> | ||
about | ||
</a> | ||
|
||
{#if $navigating} | ||
navigating to {$navigating.to.url.pathname} | ||
{/if} | ||
</nav> | ||
|
||
<slot /> | ||
|
||
{#if $updated} | ||
<div class="toast"> | ||
<p> | ||
A new version of the app is available | ||
|
||
<button on:click={() => location.reload()}> | ||
reload the page | ||
</button> | ||
</p> | ||
</div> | ||
{/if} | ||
|
||
<style> | ||
.toast { | ||
position: fixed; | ||
left: 0; | ||
bottom: 0; | ||
width: 100%; | ||
padding: 1rem; | ||
display: flex; | ||
justify-content: center; | ||
gap: 1rem; | ||
} | ||
.toast p { | ||
display: flex; | ||
align-items: center; | ||
gap: 1rem; | ||
background: var(--bg-2); | ||
padding: 0.5rem 0.5rem 0.5rem 1rem; | ||
border-radius: 4px; | ||
} | ||
</style> | ||
|
3c3af89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
learn-svelte-dev – ./
learn-svelte-dev-svelte.vercel.app
learn-svelte-dev.vercel.app
learn.svelte.dev
learn-svelte-dev-git-main-svelte.vercel.app