-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update data fetching example in starter-basic
- Loading branch information
1 parent
3cceb4a
commit 564ce2f
Showing
7 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
examples/starter-basic/src/routes/examples/[mode]/__components/Spinner.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,17 @@ | ||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" | ||
><style> | ||
.spinner_ajPY { | ||
transform-origin: center; | ||
animation: spinner_AtaB 0.75s infinite linear; | ||
} | ||
@keyframes spinner_AtaB { | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
</style><path | ||
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" | ||
opacity=".25" /><path | ||
d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" | ||
class="spinner_ajPY" | ||
id="foo" /></svg> |
31 changes: 31 additions & 0 deletions
31
examples/starter-basic/src/routes/examples/[mode]/data-fetching/__spinner.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,31 @@ | ||
<script> | ||
import { pendingRoute } from '@roxi/routify' | ||
import Spinner from '../__components/Spinner.svelte' | ||
</script> | ||
|
||
{#if $pendingRoute} | ||
<div class="spinner-wrapper"> | ||
<div class="spinner-overlay" /> | ||
<Spinner /> | ||
</div> | ||
{/if} | ||
|
||
<style> | ||
.spinner-wrapper { | ||
position: fixed; | ||
inset: 0; | ||
display: grid; | ||
place-items: center; | ||
} | ||
.spinner-wrapper > :global(svg) { | ||
position: relative; | ||
width: 15vw; | ||
} | ||
.spinner-overlay { | ||
position: absolute; | ||
inset: 0; | ||
background: var(--surface-1); | ||
opacity: 0.7; | ||
pointer-events: none; | ||
} | ||
</style> |
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
4 changes: 3 additions & 1 deletion
4
examples/starter-basic/src/routes/examples/[mode]/data-fetching/data.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
3 changes: 0 additions & 3 deletions
3
examples/starter-basic/src/routes/examples/[mode]/data-fetching/index.md
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
examples/starter-basic/src/routes/examples/[mode]/data-fetching/index.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,15 @@ | ||
<script> | ||
import { url } from '@roxi/routify' | ||
</script> | ||
|
||
<p> | ||
This example demonstrates how to utilize the `load` hook to fetch and return data via | ||
a | ||
</p> | ||
|
||
<p> | ||
"props" object. Navigate to data.svelte to see how we retrieve data from a Star Wars | ||
API and make it accessible for our component. | ||
</p> | ||
|
||
<a href="../data" use:$url data-routify-prefetch-data="hover">prefetch data on hover</a> |
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