-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is there documentation for decorator support #70
Comments
i found this which does mention it but the story decorator and global decorator does not work |
@sacrosanctic can you give an example of a use case for this, given that you can define nested components in Is it so that you can define some outer components that all stories are wrapped in, without having to copy them for each I don't think defining decorators within the same file is supported in this addon yet. |
Decorator are handled by Storybook, not this addon. "It shoud work" because Storybook is rendering our stories as child of the global/story decorator |
I can't reproduce any issue with decorators. The official doc seem to be working fine. The syntax here is not special: <Meta component={Button} decorators={[() => MarginDecorator]}/> and with the new meta export, it's exactly like in the official storybook documentation: <script context="module">
import Button from './Button.svelte';
export const meta = {
component: Button,
decorators: [() => MarginDecorator]
}
</script> Feel free to reopen this issue if you need more details. |
Documentation regarding how to properly implement decorators would be really appreciated. My decorator works, but I get a typescript type error.
Also, how would I pass parameters/props to it from the
decorators: [
(story, { parameters }) =>
parameters.dualTheme !== false ? (DualTheme as any) : story(),
], |
Aight, I'll reopen for investigation. |
I don't fully understand this question, can you elaborate with a use case? @svallory |
@JReinhold I could have explained it a little better 😅 In the example below, I'm checking for the boolean parameter
That's fine for this scenario, but what if I wanted something more complex? Since I'm returning the default export of the Svelte component as is, I have no idea how I can pass the entire |
it says decorators are supported but i cant find any example code, either for individual stories or globally
https://storybook.js.org/docs/svelte/get-started/whats-a-story
https://github.com/storybookjs/addon-svelte-csf#readme
The text was updated successfully, but these errors were encountered: