Skip to content

Commit

Permalink
Add a better loading
Browse files Browse the repository at this point in the history
  • Loading branch information
dtonon committed Jun 6, 2024
1 parent 07a867b commit a3cc63f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import * as nip19 from 'nostr-tools/nip19'
import { Splide, SplideSlide } from '@splidejs/svelte-splide';
import '@splidejs/svelte-splide/css';
import Loading from './Loading.svelte';
let events = [];
let shortEvents = [];
Expand Down Expand Up @@ -226,5 +227,5 @@
</div>
{/if}
{:else}
<p>Loading...</p>
<Loading />
{/if}
51 changes: 51 additions & 0 deletions src/Loading.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script>
// No JavaScript logic is needed for this simple loading animation
</script>

<style>
.loader-container {
display: flex;
align-items: center;
justify-content: center;
}
.loader {
display: inline-block;
width: 92px;
height: 92px;
opacity: 0; /* Initially invisible */
animation: fade-in 0.5s 0.4s forwards, loader-animation 2s linear infinite 0.4s; /* Fade-in animation and delay for loader animation */
}
.loader:after {
content: " ";
display: block;
width: 64px;
height: 64px;
margin: 8px;
border-radius: 50%;
border: 6px solid #a9a9a9;
border-color: #a9a9a9 transparent #a9a9a9 transparent;
animation: loader-animation 2s linear infinite;
}
@keyframes loader-animation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes fade-in {
to {
opacity: 1;
}
}
</style>

<div class="loader-container">
<div class="loader"></div>
</div>
3 changes: 2 additions & 1 deletion src/Note.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import showdown from 'showdown';
import * as nip19 from 'nostr-tools/nip19'
import "zapthreads";
import Loading from './Loading.svelte';
let relays;
let note = {};
Expand Down Expand Up @@ -116,5 +117,5 @@
<zap-threads anchor="{note1}" relays="{relays}" />
{/if}
{:else}
<p>Loading...</p>
<Loading />
{/if}

0 comments on commit a3cc63f

Please sign in to comment.