feature/project-redesign #28

Merged
ilia merged 88 commits from feature/project-redesign into main 2026-03-02 19:46:39 +00:00
Showing only changes of commit 8fa376ef94 - Show all commits

View File

@@ -0,0 +1,29 @@
import type { TitleStatusChangeHandler } from '$shared/ui';
import type { Snippet } from 'svelte';
import { scrollBreadcrumbsStore } from '../../store/scrollBreadcrumbsStore.svelte';
/**
* Updates the breadcrumb store when the title visibility status changes.
*
* @param index - Index of the section
* @param isPast - Whether the section is past the current scroll position
* @param title - Snippet for a title itself
* @param id - ID of the section
* @returns Cleanup callback
*/
export const handleTitleStatusChanged: TitleStatusChangeHandler = (
index: number,
isPast: boolean,
title?: Snippet<[{ className?: string }]>,
id?: string,
) => {
if (isPast && title) {
scrollBreadcrumbsStore.add({ index, title, id });
} else {
scrollBreadcrumbsStore.remove(index);
}
return () => {
scrollBreadcrumbsStore.remove(index);
};
};