Skip to content
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

The doc of subcomponents doesn't apper if displayName is declared in the subcomponent #17621

Open
RodrigoTomeES opened this issue Mar 3, 2022 · 2 comments

Comments

@RodrigoTomeES
Copy link

RodrigoTomeES commented Mar 3, 2022

Describe the bug
No inputs found in Subcomponents

To Reproduce
https://github.com/RodrigoTomeES/storybook-no-inputs-subcomponents

System

  System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 17.3.1 - ~/.nvm/versions/node/v17.3.1/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v17.3.1/bin/yarn
    npm: 8.3.0 - ~/.nvm/versions/node/v17.3.1/bin/npm
  Browsers:
    Chrome: 99.0.4844.51
    Firefox: 97.0.1
    Safari: 15.3

Additional context
We create a component that use submodules and we want to see the props of this in Storybook. I managed to get this working in JavaScript but not in Typescript. Has anyone any idea about the problem? thanks!

Main component
imagen

Subcomponent, it should show the className prop
imagen

@RodrigoTomeES
Copy link
Author

Hi,

I have an update about this issue, if you change the name of your subcomponent in the subcomponent file the docs doesn't work, but if you change it in the index of the parent component it works.

LineTable: this does that documentation doesn't work

export cont LineTable = () => <div>Do Something</div>;

LineTable.displayName = 'Table.Line';

Index of table: if you put the displayName here documentation works

import { Table } from './Table';
import { LineTable } from './LineTable';

export type TypeTable = typeof Table & {
  Line: typeof LineTable;
};

(Table as TypeTable).Line = LineTable;

LineTable.displayName = 'Table.Line';

export default Table as TypeTable;

@RodrigoTomeES RodrigoTomeES changed the title No inputs found in Subcomponents The doc of subcomponents doesn't apper if displayName is declared in the subcomponent Mar 30, 2022
@xandmore
Copy link

@RodrigoTomeES the workaround I used:

export const LineTable = () => <div>Do Something</div>;

{
  LineTable.displayName = 'Table.Line';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants