|
8 | 8 | import IoIosAt from 'svelte-icons/io/IoIosAt.svelte';
|
9 | 9 | import SvelteMarkdown from 'svelte-markdown';
|
10 | 10 | import IoIosCopy from 'svelte-icons/io/IoIosCopy.svelte';
|
| 11 | + import { RingLoader } from 'svelte-loading-spinners'; |
11 | 12 |
|
12 | 13 | // Reactive state to track the selected tab index
|
13 | 14 | let selectedTabIndex = 0;
|
|
44 | 45 | console.log(codeHTMLs);
|
45 | 46 | </script>
|
46 | 47 |
|
47 |
| -<div class="tabs"> |
48 |
| - <ul style="display: flex; justify-content: center; flex-direction: row; flex-wrap: wrap;"> |
49 |
| - {#each tabs as tab, index} |
50 |
| - <li |
51 |
| - on:click={() => (selectedTabIndex = index)} |
52 |
| - class:selectedTab={selectedTabIndex === index} |
53 |
| - > |
54 |
| - {tab.title} |
55 |
| - </li> |
56 |
| - {/each} |
57 |
| - </ul> |
58 |
| - <div class="content"> |
59 |
| - {#each tabs as tab, index} |
60 |
| - <section class:selectedContent={selectedTabIndex === index}> |
61 |
| - <div |
62 |
| - style="padding: 0; display: flex; flex-direction: column; justify-content: space-around; gap: 0rem; align-items: center" |
| 48 | +{#if isLoading} |
| 49 | + <div |
| 50 | + style="width: 100%; height: 50vh; display: flex; justify-content: center; align-items: center" |
| 51 | + > |
| 52 | + <RingLoader size="60" color="#6e4582" unit="px" duration="1s" /> |
| 53 | + </div> |
| 54 | +{:else} |
| 55 | + <div class="tabs"> |
| 56 | + <ul style="display: flex; justify-content: center; flex-direction: row; flex-wrap: wrap;"> |
| 57 | + {#each tabs as tab, index} |
| 58 | + <li |
| 59 | + on:click={() => (selectedTabIndex = index)} |
| 60 | + class:selectedTab={selectedTabIndex === index} |
63 | 61 | >
|
64 |
| - <h1 style="color: white; font-weight: 600;">{tab.title}</h1> |
65 |
| - {#if tab.code && !isLoading} |
66 |
| - <div class="code-container"> |
67 |
| - <button on:click={() => navigator.clipboard.writeText(tab.code)} class="copy-icon"> |
68 |
| - <IoIosCopy /> |
69 |
| - </button> |
70 |
| - {@html codeHTMLs[index]} |
| 62 | + {tab.title} |
| 63 | + </li> |
| 64 | + {/each} |
| 65 | + </ul> |
| 66 | + <div class="content"> |
| 67 | + {#each tabs as tab, index} |
| 68 | + <section class:selectedContent={selectedTabIndex === index}> |
| 69 | + <div |
| 70 | + style="padding: 0; display: flex; flex-direction: column; justify-content: space-around; gap: 0rem; align-items: center" |
| 71 | + > |
| 72 | + <h1 style="color: white; font-weight: 600;">{tab.title}</h1> |
| 73 | + {#if tab.code && !isLoading} |
| 74 | + <div class="code-container"> |
| 75 | + <button on:click={() => navigator.clipboard.writeText(tab.code)} class="copy-icon"> |
| 76 | + <IoIosCopy /> |
| 77 | + </button> |
| 78 | + {@html codeHTMLs[index]} |
| 79 | + </div> |
| 80 | + {/if} |
| 81 | + <div class="markdown-container"> |
| 82 | + <SvelteMarkdown source={tab.content} /> |
71 | 83 | </div>
|
72 |
| - {/if} |
73 |
| - <div class="markdown-container"> |
74 |
| - <SvelteMarkdown source={tab.content} /> |
75 | 84 | </div>
|
76 |
| - </div> |
77 |
| - </section> |
78 |
| - {/each} |
| 85 | + </section> |
| 86 | + {/each} |
| 87 | + </div> |
79 | 88 | </div>
|
80 |
| -</div> |
| 89 | +{/if} |
81 | 90 |
|
82 | 91 | <style lang="scss">
|
83 | 92 | h1 {
|
|
0 commit comments