From 820d442f72dc4115faa7719d45d2749d27b19de5 Mon Sep 17 00:00:00 2001 From: Ben Kates Date: Wed, 1 May 2024 16:52:34 -0400 Subject: [PATCH 01/10] init loadingwrapper --- .../LoadingWrapper.stories.svelte | 47 +++++++++++++++++ src/lib/LoadingWrapper/LoadingWrapper.svelte | 50 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 src/lib/LoadingWrapper/LoadingWrapper.stories.svelte create mode 100644 src/lib/LoadingWrapper/LoadingWrapper.svelte diff --git a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte new file mode 100644 index 00000000..c96d9633 --- /dev/null +++ b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte @@ -0,0 +1,47 @@ + + + + + + + diff --git a/src/lib/LoadingWrapper/LoadingWrapper.svelte b/src/lib/LoadingWrapper/LoadingWrapper.svelte new file mode 100644 index 00000000..6b67a7b9 --- /dev/null +++ b/src/lib/LoadingWrapper/LoadingWrapper.svelte @@ -0,0 +1,50 @@ + + +
+ {#if childLoading} +
+ + + +
+ {/if} + +
+ + From 7987cd26b9750aac072c4bf4ea8f1c49d8a6475f Mon Sep 17 00:00:00 2001 From: Ben Kates Date: Wed, 1 May 2024 16:59:03 -0400 Subject: [PATCH 02/10] init stories --- .../LoadingWrapper.stories.svelte | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte index c96d9633..5b1b029d 100644 --- a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte +++ b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte @@ -1,6 +1,8 @@ - +
- + + + (mapLoading = false)} + /> + + From 88468045cf533bbd71da346c2f0bfc7dd39b5f02 Mon Sep 17 00:00:00 2001 From: Ben Kates Date: Fri, 3 May 2024 13:50:55 -0400 Subject: [PATCH 03/10] update dw example --- src/lib/LoadingWrapper/LoadingWrapper.stories.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte index 5b1b029d..3fb3b601 100644 --- a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte +++ b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte @@ -64,7 +64,7 @@ (mapLoading = false)} /> From fe797c1f6209dad19ad9203a143da4ca08c22ca6 Mon Sep 17 00:00:00 2001 From: Ben Kates Date: Fri, 3 May 2024 14:06:38 -0400 Subject: [PATCH 04/10] changelog and component export --- CHANGELOG.md | 2 ++ src/lib/index.js | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a1bc2b..851fcfcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next +- Add LoadingWrapper component to provide a loading graphic for components that need it + ## v0.8.0 - Simplify CSS in Toggle component diff --git a/src/lib/index.js b/src/lib/index.js index bafe22a8..ccfe1829 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -25,3 +25,4 @@ export { default as Scrolly } from "./Scrolly/Scrolly.svelte"; export { default as Analytics, logClickToGA } from "./Analytics/Analytics.svelte"; export { default as Headline } from "./Headline/Headline.svelte"; export { default as PymChild } from "./Pym/PymChild.svelte"; +export { default as LoadingWrapper } from "./LoadingWrapper/LoadingWrapper.svelte"; From f0c00f7c89169ce4ef7d0a79d25c19b4dd1f1bb2 Mon Sep 17 00:00:00 2001 From: Ben Kates Date: Tue, 7 May 2024 11:07:13 -0400 Subject: [PATCH 05/10] expose "set loading" functions --- .../LoadingWrapper/LoadingWrapper.stories.svelte | 11 +++++------ src/lib/LoadingWrapper/LoadingWrapper.svelte | 14 +++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte index 3fb3b601..acb37363 100644 --- a/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte +++ b/src/lib/LoadingWrapper/LoadingWrapper.stories.svelte @@ -28,18 +28,17 @@ return new Promise((resolve) => setTimeout(resolve, ms)); } + // set loading for paragraph examples, sleep for 2.5 sec on mount $: loading = true; onMount(() => { sleep(2500).then(() => { loading = false; }); }); - - $: mapLoading = true; - + Amet est Lorem qui ullamco laboris velit. Incididunt est sunt exercitation qui ea. Officia Lorem est labore amet irure nostrud. Exercitation Lorem do consectetur enim esse quis mollit @@ -49,7 +48,7 @@ - + Amet est Lorem qui ullamco laboris velit. Incididunt est sunt exercitation qui ea. Officia @@ -60,12 +59,12 @@ - + (mapLoading = false)} + on:visrendered={childLoaded} /> diff --git a/src/lib/LoadingWrapper/LoadingWrapper.svelte b/src/lib/LoadingWrapper/LoadingWrapper.svelte index 6b67a7b9..360c300f 100644 --- a/src/lib/LoadingWrapper/LoadingWrapper.svelte +++ b/src/lib/LoadingWrapper/LoadingWrapper.svelte @@ -6,7 +6,15 @@ * Boolean indicating whether the child component is loading or not * @type {boolean} */ - export let childLoading; + export let isChildLoading; + + let childLoaded = () => { + isChildLoading = false; + }; + + let childLoading = () => { + isChildLoading = true; + }; /** * The background color of the loading container (can be null for transparent background) @@ -16,14 +24,14 @@
- {#if childLoading} + {#if isChildLoading}
{/if} - +