Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Importing component defined in index breaks the docgen #84

Open
NathanDeveloping opened this issue Jan 23, 2020 · 1 comment
Open

Importing component defined in index breaks the docgen #84

NathanDeveloping opened this issue Jan 23, 2020 · 1 comment

Comments

@NathanDeveloping
Copy link

doesn't work :

index.tsx

import * as React from 'react';

export interface AProps {
  name?: string;
}

const A: React.FunctionComponent<AProps> = ({name}) => {
  return <p>{name}</p>;
};

A.displayName = 'A';

export {A};

a.story.mdx

import {Meta, Story, Preview, Props} from '@storybook/addon-docs/blocks';
import {A} from '.';  // <------------------

<Meta title="A" component={A} />

<Story name="Default">
  <A name="pelo" />
</Story>

<Props of={A} />

works:

A.tsx

same as index.tsx above

a.story.tsx

import {A} from './A'; // <------------------

<Meta title="A" component={A} />

<Story name="Default">
  <A name="pelo" />
</Story>

<Props of={A} />
@NathanDeveloping
Copy link
Author

It seems that component files named with hypen cannot be parsed too

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

No branches or pull requests

1 participant