improve loading state of course nav items

This commit is contained in:
Rotimi Best
2023-12-11 21:32:41 +03:00
parent bbe6e78f88
commit f81a3fde9e
@@ -25,23 +25,25 @@
</script> </script>
<div class=""> <div class="">
{#if isLoading}
<div class="w-11/12 mx-auto">
<SkeletonText class="py-3 px-4 mb-3 rounded-md" style="height: 40px;" />
</div>
{:else}
<button <button
class="item relative flex items-center py-3 px-4 ml-2 mb-1 {NavClasses.item} {isGroupActive && class="item relative flex items-center py-3 px-4 ml-2 mb-1 {NavClasses.item} {isGroupActive &&
!isLoading &&
NavClasses.active} w-[95%]" NavClasses.active} w-[95%]"
tabindex="0" tabindex="0"
on:click={onClick} on:click={onClick}
disabled={isLoading} disabled={isLoading}
> >
<NavIcons name={label} /> <NavIcons name={label} />
{#if isLoading}
<div class="w-11/12 mx-auto">
<SkeletonText class="rounded-md" style="margin: 0px; height: 30px;" />
</div>
{:else}
<span class="font-bold text-md">{label}</span> <span class="font-bold text-md">{label}</span>
{#if total} {#if total}
<span class="ml-1">({total})</span> <span class="ml-1">({total})</span>
{/if} {/if}
{/if}
<span class="grow" /> <span class="grow" />
{#if label === 'Lessons' && !isLoading} {#if label === 'Lessons' && !isLoading}
@@ -54,10 +56,9 @@
</IconButton> </IconButton>
{/if} {/if}
</button> </button>
{#if isExpanded} {#if isExpanded && !isLoading}
<div in:slide out:slide class="flex flex-col"> <div in:slide out:slide class="flex flex-col">
<slot /> <slot />
</div> </div>
{/if} {/if}
{/if}
</div> </div>