feat(Page): add new Section props for sticky titles
All checks were successful
Workflow / build (pull_request) Successful in 3m11s
Workflow / publish (pull_request) Has been skipped

This commit is contained in:
Ilia Mashkov
2026-02-18 17:40:20 +03:00
parent f18454f9b3
commit aa4796079a

View File

@@ -4,6 +4,8 @@
--> -->
<script lang="ts"> <script lang="ts">
import { scrollBreadcrumbsStore } from '$entities/Breadcrumb'; import { scrollBreadcrumbsStore } from '$entities/Breadcrumb';
import type { ResponsiveManager } from '$shared/lib';
import { cn } from '$shared/shadcn/utils/shadcn-utils';
import { import {
Logo, Logo,
Section, Section,
@@ -15,13 +17,17 @@ import CodeIcon from '@lucide/svelte/icons/code';
import EyeIcon from '@lucide/svelte/icons/eye'; import EyeIcon from '@lucide/svelte/icons/eye';
import LineSquiggleIcon from '@lucide/svelte/icons/line-squiggle'; import LineSquiggleIcon from '@lucide/svelte/icons/line-squiggle';
import ScanSearchIcon from '@lucide/svelte/icons/search'; import ScanSearchIcon from '@lucide/svelte/icons/search';
import type { Snippet } from 'svelte'; import {
type Snippet,
getContext,
} from 'svelte';
import { cubicIn } from 'svelte/easing'; import { cubicIn } from 'svelte/easing';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
let searchContainer: HTMLElement; let searchContainer: HTMLElement;
let isExpanded = $state(false); let isExpanded = $state(true);
const responsive = getContext<ResponsiveManager>('responsive');
function handleTitleStatusChanged( function handleTitleStatusChanged(
index: number, index: number,
@@ -39,39 +45,37 @@ function handleTitleStatusChanged(
scrollBreadcrumbsStore.remove(index); scrollBreadcrumbsStore.remove(index);
}; };
} }
// $effect(() => {
// appliedFontsManager.touch(
// selectedFontsStore.all.map(font => ({
// slug: font.id,
// weight: controlManager.weight,
// })),
// );
// });
</script> </script>
<!-- Font List --> <!-- Font List -->
<div <div
class="p-2 sm:p-3 md:p-4 h-full flex flex-col gap-3 sm:gap-4" class="p-2 sm:p-3 md:p-4 h-full grid gap-3 sm:gap-4 grid-cols-[max-content_1fr]"
in:fade={{ duration: 500, delay: 150, easing: cubicIn }} in:fade={{ duration: 500, delay: 150, easing: cubicIn }}
> >
<Section class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-8" onTitleStatusChange={handleTitleStatusChanged}> <Section
class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-8"
onTitleStatusChange={handleTitleStatusChanged}
>
{#snippet icon({ className })} {#snippet icon({ className })}
<CodeIcon class={className} /> <CodeIcon class={className} />
{/snippet} {/snippet}
{#snippet description({ className })} {#snippet description({ className })}
<span class={className}> <span class={className}> Project_Codename </span>
Project_Codename
</span>
{/snippet} {/snippet}
{#snippet content({ className })}
<div class={cn(className, 'col-start-0 col-span-2')}>
<Logo /> <Logo />
</div>
{/snippet}
</Section> </Section>
<Section <Section
class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-8" class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-x-12 sm:gap-y-8"
index={1} index={1}
id="optical_comparator" id="optical_comparator"
onTitleStatusChange={handleTitleStatusChanged} onTitleStatusChange={handleTitleStatusChanged}
stickyTitle={responsive.isDesktopLarge}
stickyOffset="4rem"
> >
{#snippet icon({ className })} {#snippet icon({ className })}
<EyeIcon class={className} /> <EyeIcon class={className} />
@@ -81,14 +85,20 @@ function handleTitleStatusChanged(
Optical<br />Comparator Optical<br />Comparator
</h1> </h1>
{/snippet} {/snippet}
{#snippet content({ className })}
<div class={cn(className, !responsive.isDesktopLarge && 'col-start-0 col-span-2')}>
<ComparisonSlider /> <ComparisonSlider />
</div>
{/snippet}
</Section> </Section>
<Section <Section
class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-8" class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-x-12 sm:gap-y-8"
index={2} index={2}
id="query_module" id="query_module"
onTitleStatusChange={handleTitleStatusChanged} onTitleStatusChange={handleTitleStatusChanged}
stickyTitle={responsive.isDesktopLarge}
stickyOffset="4rem"
> >
{#snippet icon({ className })} {#snippet icon({ className })}
<ScanSearchIcon class={className} /> <ScanSearchIcon class={className} />
@@ -98,14 +108,20 @@ function handleTitleStatusChanged(
Query<br />Module Query<br />Module
</h2> </h2>
{/snippet} {/snippet}
{#snippet content({ className })}
<div class={cn(className, !responsive.isDesktopLarge && 'col-start-0 col-span-2')}>
<FontSearch bind:showFilters={isExpanded} /> <FontSearch bind:showFilters={isExpanded} />
</div>
{/snippet}
</Section> </Section>
<Section <Section
class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-8" class="py-4 sm:py-10 md:py-12 gap-6 sm:gap-x-12 sm:gap-y-8"
index={3} index={3}
id="sample_set" id="sample_set"
onTitleStatusChange={handleTitleStatusChanged} onTitleStatusChange={handleTitleStatusChanged}
stickyTitle={responsive.isDesktopLarge}
stickyOffset="4rem"
> >
{#snippet icon({ className })} {#snippet icon({ className })}
<LineSquiggleIcon class={className} /> <LineSquiggleIcon class={className} />
@@ -115,7 +131,11 @@ function handleTitleStatusChanged(
Sample<br />Set Sample<br />Set
</h2> </h2>
{/snippet} {/snippet}
{#snippet content({ className })}
<div class={cn(className, !responsive.isDesktopLarge && 'col-start-0 col-span-2')}>
<SampleList /> <SampleList />
</div>
{/snippet}
</Section> </Section>
</div> </div>