2026-01-20 09:40:42 +03:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { appliedFontsManager } from '$entities/Font';
|
2026-01-20 14:21:07 +03:00
|
|
|
import { controlManager } from '$features/SetupFont';
|
2026-01-20 09:40:42 +03:00
|
|
|
import { Input } from '$shared/shadcn/ui/input';
|
2026-01-21 21:57:04 +03:00
|
|
|
import { ComparisonSlider } from '$widgets/ComparisonSlider/ui';
|
2026-01-20 09:40:42 +03:00
|
|
|
import { displayedFontsStore } from '../../model';
|
|
|
|
|
import PairSelector from '../PairSelector/PairSelector.svelte';
|
|
|
|
|
|
|
|
|
|
let displayedText = $state('The quick brown fox jumps over the lazy dog...');
|
|
|
|
|
const [fontA, fontB] = $derived(displayedFontsStore.selectedPair);
|
|
|
|
|
const hasAnyPairs = $derived(displayedFontsStore.fonts.length > 0);
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
2026-01-21 21:57:04 +03:00
|
|
|
appliedFontsManager.touch(
|
|
|
|
|
displayedFontsStore.fonts.map(font => ({ slug: font.id, weight: controlManager.weight })),
|
|
|
|
|
);
|
2026-01-20 09:40:42 +03:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if hasAnyPairs}
|
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
|
<div class="flex flex-row gap-4">
|
|
|
|
|
<Input bind:value={displayedText} />
|
|
|
|
|
<PairSelector />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if fontA && fontB}
|
2026-01-20 14:21:07 +03:00
|
|
|
<ComparisonSlider
|
|
|
|
|
fontA={fontA}
|
|
|
|
|
fontB={fontB}
|
2026-01-21 21:57:04 +03:00
|
|
|
bind:text={displayedText}
|
2026-01-20 14:21:07 +03:00
|
|
|
/>
|
2026-01-20 09:40:42 +03:00
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|