withFireflyDecorator
Create a Decorator function that returns a FireflyDecorator component wrapping the story with all the required plumbing to render a component using Squide, including a RouterProvider.
Reference
const decorator = withFireflyDecorator(runtime)
Parameters
runtime: AStorybookRuntimeinstance.
Returns
A Decorator function.
Usage
import { initializeFireflyForStorybook, withFireflyDecorator } from "@squide/firefly-storybook";
import type { Decorator, Meta, StoryObj } from "storybook-react-rsbuild";
import { Page } from "./Page.tsx";
import { registerModule } from "./registerModule.tsx";
const fireflyRuntime = await initializeFireflyForStorybook({
localModules: [registerModule]
});
const meta = {
title: "Page",
component: Page,
decorators: [
withFireflyDecorator(fireflyRuntime)
],
parameters: {
msw: {
handlers: [
...fireflyRuntime.requestHandlers
]
}
}
} satisfies Meta<typeof Page>;