-
Notifications
You must be signed in to change notification settings - Fork 673
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
sx prop not applied in Storybook, but applied successfully in Next.js app #1872
Comments
Hey @seisenreich I believe this is a duplicate issue.
|
Hi @fcisio , I thought so at first, too. What didn't get fixed was the support of the sx prop. I don't know if the problem is caused by the same thing, though. |
Also the styles in my case look a bit different. Fun thing you can see here: |
Okay, so the JSX pragma running in Storybook doesn't know about Edit: I cloned your repo and managed to fix it. Add the following to .storybook/.babelrc to tell Storybook about your Babel setup. {
"extends": "../babel.config.js"
} Explanation: The part of configuration that makes
We tell Next's Babel Preset to tell Babel Preset React that all JSX will be from now on handled by Storybook didn't detect your Babel config, so no JSX pragma there. Thanks for the repro, @seisenreich, it helped a lot. Screenshot after my change: |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
Me and my team use Storybook, Next.JS, Theme UI and emotion/css + emotion/styled with TypeScript to build a frontend with a custom UI kit.
After using Styled System with Styled Components we decided to merge over to Theme UI with emotion due to better maintenance and active community.
We faced a few problems to get that tech stack working.
One of them being storybook not supporting emotion v11 used by Theme UI. We could fix it by applying this solution.
Everything builds just fine: The Next.js app builds fine, Storybook builds fine.
Theme properties can be accessed successfully in both, the Next.js app and storybook from emotion/styled components and from react components using the useTheme hook.
sx prop styling works fine in the Next.js app.
But any styling that should be applied from the sx prop is ignored in Storybook. And I don't get why.
Maybe you can help me with this?
I'm not sure what information I have to give you so you can actually help me.
Just ask me if something's missing.
I built a small repo for you to reproduce the issue.
The most of my actual projects config files and the essential dependencies are uploaded there.
To Reproduce
Steps to reproduce the behavior:
Screenshots
The text was updated successfully, but these errors were encountered: