Files
frontend-svelte/src/routes/Page.svelte

95 lines
2.8 KiB
Svelte
Raw Normal View History

<!--
Component: Page
Description: The main page component of the application.
-->
<script lang="ts">
2026-02-02 12:21:23 +03:00
import { BreadcrumbHeader } from '$entities/Breadcrumb';
import { scrollBreadcrumbsStore } from '$entities/Breadcrumb';
import { Section } from '$shared/ui';
import ComparisonSlider from '$widgets/ComparisonSlider/ui/ComparisonSlider/ComparisonSlider.svelte';
2026-01-24 15:39:38 +03:00
import { FontSearch } from '$widgets/FontSearch';
import { SampleList } from '$widgets/SampleList';
import LineSquiggleIcon from '@lucide/svelte/icons/line-squiggle';
import ScanEyeIcon from '@lucide/svelte/icons/scan-eye';
2026-02-02 12:21:23 +03:00
import ScanSearchIcon from '@lucide/svelte/icons/search';
import type { Snippet } from 'svelte';
2026-01-24 15:39:38 +03:00
let searchContainer: HTMLElement;
let isExpanded = $state(false);
2026-02-02 12:21:23 +03:00
function handleTitleStatusChanged(index: number, isPast: boolean, title?: Snippet<[{ className?: string }]>) {
if (isPast && title) {
scrollBreadcrumbsStore.add({ index, title });
} else {
scrollBreadcrumbsStore.remove(index);
}
return () => {
scrollBreadcrumbsStore.remove(index);
};
}
2026-02-02 12:21:23 +03:00
// $effect(() => {
// appliedFontsManager.touch(
// selectedFontsStore.all.map(font => ({
// slug: font.id,
// weight: controlManager.weight,
// })),
// );
// });
</script>
2026-02-02 12:21:23 +03:00
<BreadcrumbHeader />
2026-01-13 20:05:33 +03:00
<!-- Font List -->
2026-01-30 01:09:39 +03:00
<div class="p-2 h-full flex flex-col gap-3">
2026-02-02 12:21:23 +03:00
<Section class="my-12 gap-8" index={0} onTitleStatusChange={handleTitleStatusChanged}>
{#snippet icon({ className })}
<ScanEyeIcon class={className} />
{/snippet}
{#snippet title({ className })}
<h1 class={className}>
2026-02-02 12:21:23 +03:00
Optical<br />Comparator
</h1>
{/snippet}
<ComparisonSlider />
</Section>
2026-02-02 12:21:23 +03:00
<Section class="my-12 gap-8" index={1} onTitleStatusChange={handleTitleStatusChanged}>
{#snippet icon({ className })}
<ScanSearchIcon class={className} />
{/snippet}
{#snippet title({ className })}
<h2 class={className}>
Query<br />Module
</h2>
{/snippet}
<FontSearch bind:showFilters={isExpanded} />
</Section>
<Section class="my-12 gap-8" index={2} onTitleStatusChange={handleTitleStatusChanged}>
{#snippet icon({ className })}
<LineSquiggleIcon class={className} />
{/snippet}
{#snippet title({ className })}
<h2 class={className}>
2026-02-02 12:21:23 +03:00
Sample<br />Set
</h2>
{/snippet}
<SampleList />
</Section>
2026-01-18 15:01:19 +03:00
</div>
2026-01-24 15:39:38 +03:00
<style>
.content {
2026-02-02 12:21:23 +03:00
/* Tells the browser to skip rendering off-screen content */
content-visibility: auto;
/* Helps the browser reserve space without calculating everything */
contain-intrinsic-size: 1px 1000px;
2026-02-02 12:21:23 +03:00
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
2026-01-24 15:39:38 +03:00
</style>