fix: minor changes

This commit is contained in:
Ilia Mashkov
2026-01-13 20:09:30 +03:00
parent 7146328982
commit 76172aaa6b
2 changed files with 38 additions and 12 deletions

View File

@@ -1,20 +1,46 @@
<script lang="ts"> <script lang="ts">
import { fontshareStore } from '$entities/Font/model/store/fontshareStore.svelte';
import type { UnifiedFont } from '$entities/Font/model/types/normalize';
import { import {
Content as ItemContent, Content as ItemContent,
Root as ItemRoot, Root as ItemRoot,
Title as ItemTitle, Title as ItemTitle,
} from '$shared/shadcn/ui/item'; } from '$shared/shadcn/ui/item';
import { VirtualList } from '$shared/ui'; import { VirtualList } from '$shared/ui';
import { fontCollection } from '../../model'; /**
* FontList
*
* Displays a virtualized list of fonts with loading, empty, and error states.
* Uses unifiedFontStore from context for data, but can accept explicit fonts via props.
*/
interface FontListProps {
/** Font items to display (defaults to filtered fonts from store) */
fonts?: UnifiedFont[];
/** Show loading state */
loading?: boolean;
/** Show empty state when no results */
showEmpty?: boolean;
/** Custom error message to display */
errorMessage?: string;
}
let {
fonts,
loading,
showEmpty = true,
errorMessage,
}: FontListProps = $props();
// const fontshareStore = getFontshareContext();
</script> </script>
<VirtualList items={fontCollection.filteredFonts}> {#each fontshareStore.fonts as font (font.id)}
{#snippet children({ item, index })}
<ItemRoot> <ItemRoot>
<ItemContent> <ItemContent>
<ItemTitle>{item.name}</ItemTitle> <ItemTitle>{font.name}</ItemTitle>
{item.name} <span class="text-xs text-muted-foreground">
{font.category}{font.provider}
</span>
</ItemContent> </ItemContent>
</ItemRoot> </ItemRoot>
{/snippet} {/each}
</VirtualList>

View File

@@ -31,7 +31,7 @@ let {
}: Props = $props(); }: Props = $props();
let open = $state(false); let open = $state(false);
let triggerRef = $state<HTMLInputElement>(); let triggerRef = $state<HTMLInputElement>(null!);
const contentId = useId(id); const contentId = useId(id);
function closeAndFocusTrigger() { function closeAndFocusTrigger() {