feat(storybook): create ThemeDecorator to support themeManager logic in storybook

This commit is contained in:
Ilia Mashkov
2026-02-27 12:24:16 +03:00
parent 661f3f0ae3
commit bf79cbb26f

View File

@@ -0,0 +1,30 @@
<!--
Component: ThemeDecorator
Storybook decorator that initializes ThemeManager for theme-related stories.
Ensures theme management works correctly in Storybook's iframe environment.
-->
<script lang="ts">
import { themeManager } from '$features/ChangeAppTheme';
import {
onDestroy,
onMount,
} from 'svelte';
interface Props {
children: import('svelte').Snippet;
}
let { children }: Props = $props();
// Initialize themeManager on mount
onMount(() => {
themeManager.init();
});
// Clean up themeManager when story unmounts
onDestroy(() => {
themeManager.destroy();
});
</script>
{@render children()}