Closed tobiastimm closed 5 years ago
Hello,
Can you upload a minimal reproduction? (You can copy the example project from this repo, add styled-components, and push to a repo).
Out of curiosity, are those components (base button/ button/ primary button) spread across different files? If so, what file contains the props interface?
@strothj I've updated the example in my fork. https://github.com/tobiastimm/react-docgen-typescript-loader/tree/master/packages/react-docgen-typescript-loader-example Same behaviour
Awesome thank you. I will check this out sometime tomorrow
Hello,
I've reproduced the issue in Styleguidest as well, which means the issue lies in how react-docgen-typescript is handling the parsing.
I've uploaded a test repo with your component so you can open an issue there and have something to reference: https://github.com/strothj/react-docgen-typescript-loader-styleguidist-test-styled-components
Weird enough, if you change:
const BaseButton: StatelessComponent<ButtonProps> = ({
to
export const BaseButton: StatelessComponent<ButtonProps> = ({
the component gets detected as BaseButton
and the props populate correctly. Obviously, you want the name to show up as PrimaryButton
.
@strothj ah okay. Yeah I only want to export PrimaryButton
I updated the reference project from https://github.com/strothj/react-docgen-typescript-loader/issues/13#issuecomment-396644880. I believe updates from react-docgen-typescript
have resolved the issue.
I've created a button with styled-components. My Button has different variants
In storybook the result is