Closed chalovega closed 1 year ago
Hey @chalovega 👋
That's an interesting one! Can you show me the repo or create a reproduction codebase for me to poke around in? It's hard to know what's happening without seeing how your docs are trying to consume the theme
i'll try to create a repro this weekend, thanks Shaun
i'm closing this because i ended up fixing it by both setting theme on docs config, like this:
// preview.ts
import { themes } from '@storybook/theming'
...
docs: {
theme: themes.light,
},
... and changing the way I treated themes in my components. I'm now basically using a custom object to get the styles values rather than an actual theme.
Hello Shaun, thank you for your work!
Describe the bug
I'm trying to create an mdx document for my component, but I'm getting the following error. I'm assuming it's a styling problem because apparently
theme
is undefined when trying to get their elementsThis is how I'm creating my theme (I'm using Styled-components, and defining a DefaultTheme type as explained here):
This is a sample of the styles used:
And this is how the theme is configured in
preview.js
I have no issue displaying the components in storybook, the problem happens only in mdx doc. Is my assumption right or is this an addon-docs problem?
Environment
Please reach me if you need more info.