|
15 | 15 |
|
16 | 16 | let y = $state(0); |
17 | 17 | let expand_navbar_mobile = $state(false); |
| 18 | + let git_star_count_client_side = $state(); |
| 19 | + (async () => { |
| 20 | + git_star_count_client_side = ( |
| 21 | + await ( |
| 22 | + await fetch("https://api.github.com/repos/Keshav-writes-code/Cherit") |
| 23 | + ).json() |
| 24 | + ).stargazers_count; |
| 25 | + })(); |
18 | 26 | </script> |
19 | 27 |
|
20 | 28 | <svelte:window bind:scrollY={y} /> |
|
51 | 59 | target="_blank" |
52 | 60 | > |
53 | 61 | <div class="i-mdi:github size-5.5"></div> |
54 | | - {git_star_count} |
| 62 | + |
| 63 | + {#if git_star_count_client_side} |
| 64 | + {git_star_count_client_side} |
| 65 | + {:else} |
| 66 | + {git_star_count} |
| 67 | + {/if} |
55 | 68 | </a> |
56 | 69 | </div> |
57 | 70 | <div class="h-full md:hidden justify-self-end"> |
|
68 | 81 | </div> |
69 | 82 | </div> |
70 | 83 | {#if expand_navbar_mobile} |
| 84 | + {@const links_arr = Object.entries(nav_links)} |
71 | 85 | <div class="w-full h-full" transition:slide> |
72 | 86 | <nav class="flex flex-col gap-1 font-semibold"> |
73 | 87 | <ul class="menu menu-lg rounded-box w-full"> |
74 | | - {#each Object.entries(nav_links) as [key, value], i} |
| 88 | + {#each links_arr as [key, value], i} |
75 | 89 | <li |
76 | | - class="animate-in slide-in-b-2 fade-in-0 animate-duration-500 animate-fill-both {i}" |
| 90 | + class="animate-in slide-in-b-2 fade-in-0 animate-duration-500 animate-fill-both" |
77 | 91 | style="animation-delay: {200 + 50 * i}ms;" |
78 | 92 | > |
79 | 93 | <a class="capitalize" href={value}>{key}</a> |
80 | 94 | </li> |
81 | 95 | {/each} |
| 96 | + <li |
| 97 | + class="mt-4 animate-in slide-in-b-2 fade-in-0 animate-duration-500 animate-fill-both" |
| 98 | + style="animation-delay: {200 + 50 * (links_arr.length + 2)}ms;" |
| 99 | + > |
| 100 | + <a |
| 101 | + href="https://github.com/Keshav-writes-code/Cherit" |
| 102 | + class="btn flex items-center" |
| 103 | + target="_blank" |
| 104 | + > |
| 105 | + <div class="i-mdi:github size-5.5"></div> |
| 106 | + |
| 107 | + {#if git_star_count_client_side} |
| 108 | + {git_star_count_client_side} |
| 109 | + {:else} |
| 110 | + {git_star_count} |
| 111 | + {/if} |
| 112 | + </a> |
| 113 | + </li> |
82 | 114 | </ul> |
83 | 115 | </nav> |
84 | 116 | </div> |
|
0 commit comments