feature/storybook-coverage #18

Merged
ilia merged 8 commits from feature/storybook-coverage into main 2026-01-18 18:00:42 +00:00
2 changed files with 33 additions and 1 deletions
Showing only changes of commit 06cb155b47 - Show all commits

View File

@@ -0,0 +1,16 @@
<script lang="ts">
interface Props {
children: import('svelte').Snippet;
width?: string; // Optional width override
}
let { children, width = 'max-w-3xl' }: Props = $props();
</script>
<div class="flex min-h-screen w-full items-center justify-center bg-slate-50 p-8">
<div class="w-full bg-white shadow-xl ring-1 ring-slate-200 rounded-xl p-12 {width}">
<div class="relative">
{@render children()}
</div>
</div>
</div>

View File

@@ -1,9 +1,10 @@
import type { Preview } from '@storybook/svelte-vite'; import type { Preview } from '@storybook/svelte-vite';
import StoryStage from './StoryStage.svelte';
import '../src/app/styles/app.css'; import '../src/app/styles/app.css';
const preview: Preview = { const preview: Preview = {
parameters: { parameters: {
layout: 'fullscreen',
controls: { controls: {
matchers: { matchers: {
color: /(background|color)$/i, color: /(background|color)$/i,
@@ -18,6 +19,21 @@ const preview: Preview = {
test: 'todo', test: 'todo',
}, },
}, },
decorators: [
(storyFn, { parameters }) => {
const { Component, props } = storyFn();
return {
Component: StoryStage,
// We pass the actual story component into the Stage via a snippet/slot
// Svelte 5 Storybook handles this mapping internally when you return this structure
props: {
children: Component,
width: parameters.stageWidth || 'max-w-3xl',
...props,
},
};
},
],
}; };
export default preview; export default preview;