|
1 | 1 | <script> |
2 | | - import { _, json, isLoading } from "svelte-i18n"; |
3 | 2 | import { onMount } from "svelte"; |
| 3 | + import { _, isLoading, json } from "svelte-i18n"; |
4 | 4 |
|
5 | | - import { osStore } from "$lib/store"; |
6 | 5 | import { config } from "$lib/config"; |
| 6 | + import { osStore } from "$lib/store"; |
7 | 7 |
|
8 | | - import Vanta from "$lib/components/Vanta.svelte"; |
9 | 8 | import Button from "$lib/components/Button.svelte"; |
10 | | - import ImageCompare from "$lib/components/ImageCompare.svelte"; |
11 | 9 | import Divider from "$lib/components/Divider.svelte"; |
| 10 | + import ImageCompare from "$lib/components/ImageCompare.svelte"; |
| 11 | + import Vanta from "$lib/components/Vanta.svelte"; |
12 | 12 |
|
13 | 13 | export let id = ""; |
14 | 14 | export let classes = ""; |
|
18 | 18 | export let buttons = []; |
19 | 19 |
|
20 | 20 | let heroContent, heroImages, githubButton, githubButtonTranslation, translatedGithubButton, unsubscribeOs; |
| 21 | + let isOsLoading = true; |
21 | 22 |
|
22 | 23 | $: { |
23 | 24 | heroContent = $json("config.site.heroContent") || ""; |
|
28 | 29 |
|
29 | 30 | // Subscribe to osStore |
30 | 31 | unsubscribeOs = osStore.subscribe((data) => { |
| 32 | + isOsLoading = data.loading; |
31 | 33 | if (!data.loading && !$isLoading) { |
32 | 34 | const translatedOsButtons = data.osButtons.map((button) => ({ |
33 | 35 | ...button, |
|
73 | 75 | <p class="text-center font-light md:text-lg xl:text-xl"> |
74 | 76 | {heroContent.description} |
75 | 77 | </p> |
76 | | - {#if buttons.length > 0} |
| 78 | + {#if buttons.length > 0 && !isOsLoading && !$isLoading} |
77 | 79 | <div class="grid grid-flow-row items-center gap-4 md:grid-flow-col"> |
78 | 80 | {#each buttons as button} |
79 | 81 | <Button highlight={button.highlight} icon={button.icon} text={button.text} href={button.href} /> |
80 | 82 | {/each} |
81 | 83 | </div> |
| 84 | + {:else if heroContent.description} |
| 85 | + <div class="grid grid-flow-row items-center gap-4 md:grid-flow-col h-12 opacity-0"> |
| 86 | + <!-- Placeholder to reserve space --> |
| 87 | + <div class="py-4 px-5 rounded min-h-12 w-32"></div> |
| 88 | + </div> |
82 | 89 | {/if} |
83 | 90 | </div> |
84 | 91 |
|
|
0 commit comments