-
Notifications
You must be signed in to change notification settings - Fork 72
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
Instructions for MDX format #22
Comments
@binhxn // `decorators={[withDesign]}` is not needed when you put it as a global decorator in the config file
<Story
name="story"
decorators={[withDesign]}
parameters={{
design: {
type: 'figma',
url: 'https://your-figma-file'
}
}}
>
<YourComponent />
</Story> NOTE: I don't test this 😎 If it doesn't work please tell me. |
LGTM @pocka 👍 Would probably use |
@pocka @shilman Thank you for the speedy response. This is the code snippet of the global decorator in my // ...
import { withDesign } from 'storybook-addon-designs';
const stories = require.context(
'../src',
true,
/\.stories\.(js|ts|jsx|tsx|mdx)$/,
);
const intro = require.context('../src/Intro', false, /Intro\.stories\.mdx/);
addDecorator(withDesign);
addDecorator(story => (
<ThemeProvider theme={theme}>
<StylesGlobal />
{story()}
</ThemeProvider>
));
configure([intro, stories], module); For component/story level, I tried the example code you provided above, but no luck. Any ideas on this? |
Here's an example that's working for me at the component level: import { Meta, Story } from "@storybook/addon-docs/blocks";
import { config, withDesign } from "storybook-addon-designs";
import { Button } from "./Button";
<Meta title="Test" decorators={[withDesign]} />
<Story
name="button"
parameters={{
design: config({
type: "iframe",
url: "https://www.wikipedia.org"
})
}}
>
<Button>hello</Button>
</Story> |
@shilman Thank you, it worked! Well, with some alterations:
So using your code above, this is what worked for me:
Regardless, it solved my problem so I will close this ticket. Thank you again! |
Is there a way to implement this addon in MDX format?
Here's an example with
@storybook/addon-knobs
:Resources:
edit: add resources
The text was updated successfully, but these errors were encountered: