ArrayKnight / storybook-addon-headless

A Storybook addon to preview content from a headless CMS in components
https://storybook-addon-headless.netlify.com/
MIT License
29 stars 4 forks source link

Improve Documentation #39

Closed anshulm-soc closed 2 years ago

anshulm-soc commented 2 years ago

I was finding a way to pass data in StoryBook through APIs and came across to your Storybook addon but the Documentation is so bad. Seems like you did a good job building it but the documentation is vague & doesn't provide enough information.

For example:

  1. In the given example, what is Foos in Foos: { query: "" }?
  2. Do we need to render a story using Story. args or not?
  3. How Users component will be called with args here to render story?

    export const Users = (
    args: Args,
    { status, data }: HeadlessStoryContext<{ Users?: UserProps[] }>,
    ): ReactElement | null => {
    switch (status?.Users) {
        case FetchStatus.Inactive:
        case FetchStatus.Rejected:
            return <Prompt />
    
        case FetchStatus.Loading:
            return <Loader />
    
        default:
            return Array.isArray(data?.Users) ? (
                <>
                    {data.Users.map((user) => (
                        <UserCard key={user.id} {...user} />
                    ))}
                </>
            ) : null
    }
    }

    I have tried your examples but for me, it always shows a blank page. If you have a better example or demo somewhere then please share and make your documentation easy to understand for beginners.