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

Props / Story panels don't load #11

Closed
leonardofaria opened this issue Jun 18, 2017 · 10 comments
Closed

Props / Story panels don't load #11

leonardofaria opened this issue Jun 18, 2017 · 10 comments

Comments

@leonardofaria
Copy link

Hi

I am trying to use your addon and I am not sure what I'm missing here. I tried different setups without success. Here is what I get so far:

addons.js

import '@storybook/addons'
import '@storybook/addon-options/register'
import '@storybook/addon-actions/register'
import '@storybook/addon-knobs/register'
import 'storybook-addon-props/register'

config.js

import { configure, setAddon } from '@storybook/react'
import infoAddon from '@storybook/addon-info'
import addWithDoc from 'storybook-addon-props'
import centered from '@storybook/addon-centered'
import { setOptions } from '@storybook/addon-options'

const req = require.context('../components', true, /\.stories\.js$/)

setAddon(infoAddon)

setAddon(addWithDoc)

setAddon({
  addCentered(storyName, storyFn) {
    this.add(storyName, (context) => (
      centered.call(context, storyFn)
    ))
  },
})

// All options: https://git.io/vHpmO
setOptions({
  name: 'XX',
  url: '/',
})

function loadStories() {
  req.keys().forEach((filename) => req(filename))
}

window.STORYBOOK_REACT_CLASSES = {}

configure(loadStories, module)

story.js

import React from 'react'
import { storiesOf } from '@storybook/react'
import { withKnobs, text, boolean, select } from '@storybook/addon-knobs'
import { action } from '@storybook/addon-actions'
import centered from '@storybook/addon-centered'
import Button from './Button'

const stories = storiesOf('Button', module)
stories.addDecorator(withKnobs).addDecorator(centered)

stories.addWithDoc(
  'default',
  Button,
  'Description',
  () => {
    const classNames = {
      'btn-default': 'btn-default',
      'btn-primary': 'btn-primary',
      'btn-secondary': 'btn-secondary',
      'btn-info': 'btn-info',
      'btn-success': 'btn-success',
      'btn-error': 'btn-error',
    }
    return (
      <Button
        href={text('href', null)}
        onClick={action('toggle')}
        disabled={boolean('disabled', false)}
        className={select('className', classNames)}
      >
        {text('children', 'Hello Stranger')}
      </Button>
    )
  },
)

I am also using babel-plugin-react-docgen, which loads the component props definitions fine in the stories that use storybook-addon-info.

Do you know about some conflict between storybook-addon-props and the other ones? The only panels that I see are "Action Logger" and "Knobs".

@marc-rutkowski
Copy link
Owner

Hi Leonardo

I'm not aware of any conflict between addon-props and other addons, but I never tried to include so many of them like you do.
My advice is to try to disable all, and then add one by one to see where the problem happens.
At least you can start by removing references to addon-info which is no longer required if you want to use addon-props.

@leonardofaria
Copy link
Author

I tried that and I also pinged storybook slack channel.
One question came from there: is this addon compatible with storybook 3?

@marc-rutkowski
Copy link
Owner

Yes, I made an update 10 days ago (v3.0.2) to support storybook 3.

@przybyla
Copy link

Hello, I have exactly the same problem, no Props and Story panels. Any update about that problem?

@leonardofaria
Copy link
Author

I am not sure @przybyla

Any tip in debugging this issue @marc-rutkowski?

@marc-rutkowski
Copy link
Owner

@leonardofaria @przybyla I'm sorry but I cannot reproduce the problem and I don't have any time right now to work on this, but maybe this weekend. In the meantime if you can setup a sample repo that demonstrate problem it can be helpful.

@leonardofaria
Copy link
Author

Thanks @marc-rutkowski I will setup a sample repo and I let you know.

Could you please do the same @przybyla?

@ndelangen
Copy link

Some way I can help?

Are you registering the addon?
Is there a working example somewhere we can take a look at @marc-rutkowski ?

@marc-rutkowski
Copy link
Owner

Hi @ndelangen,

Thanks for your help.
I'm sorry but I have no time to work on this anymore.
Maybe @przybyla and @leonardofaria have some updates or can provide a sample repo?

There is an example and a .storybook directory into the source code if that can help.

I'll probably set this project as deprecated in a near future when this PR and this one will land.

@leonardofaria
Copy link
Author

I am down for making this project as deprecated since there are new PRs into the storybook.

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

4 participants