feat(FontList): use getSkeletonWidth utility for skeleton row widths

This commit is contained in:
Ilia Mashkov
2026-04-20 22:25:02 +03:00
parent ecdb1e016d
commit a801903fd3
3 changed files with 36 additions and 1 deletions
@@ -11,9 +11,11 @@ import {
VIRTUAL_INDEX_NOT_LOADED,
fontStore,
} from '$entities/Font';
import { getSkeletonWidth } from '$shared/lib/utils';
import {
Button,
Label,
Skeleton,
} from '$shared/ui';
import DotIcon from '@lucide/svelte/icons/dot';
import {
@@ -84,6 +86,20 @@ function handleSelect(font: UnifiedFont) {
itemHeight={45}
class="bg-transparent min-h-0 h-full scroll-stable py-2 pl-6 pr-4"
>
{#snippet skeleton()}
{#each { length: 12 } as _, i (i)}
<div class="w-full px-4 py-3 flex items-center justify-between border border-transparent bg-white/50 dark:bg-[#1e1e1e]/50">
<div class="flex-1 flex items-center gap-3">
<Skeleton
class="h-4 bg-neutral-200/70 dark:bg-neutral-800/70"
style="width: {getSkeletonWidth(i)}"
/>
</div>
<Skeleton class="w-1.5 h-1.5 rounded-full bg-neutral-200/70 dark:bg-neutral-800/70" />
</div>
{/each}
{/snippet}
{#snippet children({ item: font, index })}
{@const isSelectedA = font.id === comparisonStore.fontA?.id}
{@const isSelectedB = font.id === comparisonStore.fontB?.id}
@@ -96,7 +112,12 @@ function handleSelect(font: UnifiedFont) {
class="w-full px-3 md:px-4 py-2.5 md:py-3 flex !justify-between text-left text-sm"
iconPosition="right"
>
<FontApplicator {font}>{font.name}</FontApplicator>
<FontApplicator {font}>
{#snippet skeleton()}
<Skeleton class="h-4 w-32 bg-neutral-200/70 dark:bg-neutral-800/70" />
{/snippet}
{font.name}
</FontApplicator>
{#snippet icon()}
{#if active}