From 9efb718545138ce70f9403f5be1bfc92887cf684 Mon Sep 17 00:00:00 2001 From: Alexis Faizeau Date: Thu, 27 Jan 2022 15:59:19 +0100 Subject: [PATCH] Display a loader while cowebsite icon is loading --- .../CoWebsiteThumbnailSlot.svelte | 107 +++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/front/src/Components/EmbedScreens/CoWebsiteThumbnailSlot.svelte b/front/src/Components/EmbedScreens/CoWebsiteThumbnailSlot.svelte index a668bcf6..afb1179c 100644 --- a/front/src/Components/EmbedScreens/CoWebsiteThumbnailSlot.svelte +++ b/front/src/Components/EmbedScreens/CoWebsiteThumbnailSlot.svelte @@ -12,6 +12,7 @@ export let vertical: boolean; let icon: HTMLImageElement; + let iconLoaded = false; let state = coWebsite.state; const coWebsiteUrl = coWebsite.iframe.src; @@ -20,6 +21,9 @@ onMount(() => { icon.src = `${ICON_URL}/icon?url=${urlObject.hostname}&size=64..96..256&fallback_icon_color=14304c`; icon.alt = urlObject.hostname; + icon.onload = () => { + iconLoaded = true; + }; }); async function onClick() { @@ -72,7 +76,104 @@ class:vertical on:click={onClick} > - + + + + + + + + + + + + + + + + + + + +