From b0e20816a518b240b78b5676430e3df465aa502e Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sat, 10 Sep 2022 04:03:17 +0100 Subject: [PATCH] Add skeleton loading to most common pages --- chartered-frontend/src/app.pcss | 12 ++++++++++++ chartered-frontend/src/components/FeaturedCrate.svelte | 35 +++++++++++++++++++++++++++-------- chartered-frontend/src/routes/(authed)/+page.svelte | 31 ++++++++++++++++++++++--------- chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte | 13 ++++++++----- chartered-frontend/src/routes/(authed)/ssh-keys/SingleSshKey.svelte | 49 +++++++++++++++++++++++++++++++++++++++++-------- chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte | 30 +++++++++++++++++++++++++++--- chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte | 30 +++++++++++++++++++++++++++--- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 8 files changed, 244 insertions(+), 88 deletions(-) diff --git a/chartered-frontend/src/app.pcss b/chartered-frontend/src/app.pcss index 590601d..eaf9167 100644 --- a/chartered-frontend/src/app.pcss +++ a/chartered-frontend/src/app.pcss @@ -55,8 +55,20 @@ .btn-blue-outline { @apply w-fit mt-3 text-blue-700 dark:text-inherit hover:text-white border border-blue-700 hover:bg-blue-700 dark:bg-transparent focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:border-blue-600 dark:hover:bg-blue-600 focus:outline-none dark:focus:ring-blue-800 transition duration-150 ease-out; } + + .btn-skeleton-outline { + @apply w-fit mt-3 border border-slate-700 bg-transparent font-medium rounded-lg text-sm px-5 py-2.5 pointer-events-none; + } } .text-highlight { @apply text-blue-700 dark:text-blue-600; +} + +.skeleton { + @apply h-2 bg-slate-700 rounded animate-pulse; +} + +.skeleton-highlight { + @apply h-2 bg-blue-700 rounded animate-pulse; } diff --git a/chartered-frontend/src/components/FeaturedCrate.svelte b/chartered-frontend/src/components/FeaturedCrate.svelte index 4076305..9b7599e 100644 --- a/chartered-frontend/src/components/FeaturedCrate.svelte +++ a/chartered-frontend/src/components/FeaturedCrate.svelte @@ -5,19 +5,34 @@ /** * The crate to show in the card */ - export let crate: Crate; + export let crate: Crate | null; - -
-
- {crate.organisation}/{crate.name} +{#if crate} + +
+
+ {crate.organisation}/{crate.name} +
+ +
+ +
-
- + + +{:else} +
+
+
+
+
+
+ +
+ +
- - - +{/if} diff --git a/chartered-frontend/src/routes/(authed)/+page.svelte b/chartered-frontend/src/routes/(authed)/+page.svelte index 65c64a1..939c1c3 100644 --- a/chartered-frontend/src/routes/(authed)/+page.svelte +++ a/chartered-frontend/src/routes/(authed)/+page.svelte @@ -1,9 +1,8 @@