Fix loading indicator
This commit is contained in:
parent
25e57790e5
commit
6453abf47a
1 changed files with 20 additions and 9 deletions
|
@ -1,18 +1,29 @@
|
||||||
<script>
|
<script>
|
||||||
import '../app.pcss';
|
import '../app.pcss';
|
||||||
import { loading } from "$lib/stores.js";
|
import { loading } from '$lib/stores.js';
|
||||||
/**
|
import { Fa } from 'svelte-fa';
|
||||||
* @typedef {Object} Props
|
import { faSpinner } from '@fortawesome/free-solid-svg-icons';
|
||||||
* @property {import('svelte').Snippet} [children]
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @type {Props} */
|
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="bg-gray-200">
|
<div class="bg-gray-200">
|
||||||
{#if $loading}
|
|
||||||
<p class="absolute top-0 left-0">Loading</p>
|
|
||||||
{/if}
|
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
|
{#if $loading}
|
||||||
|
<div class="absolute bottom-4 right-4 spin">
|
||||||
|
<Fa size={'2x'} icon={faSpinner}></Fa>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style lang="postcss">
|
||||||
|
.spin {
|
||||||
|
animation: spin 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg) }
|
||||||
|
50% { transform: rotate(360deg) }
|
||||||
|
100% { transform: rotate(720deg) }
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in a new issue