Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Groups of knobs to organize multiple components on the same page #75

Closed
wants to merge 3 commits into from

Conversation

bastienrobert
Copy link

If the same component is several times in the same story, groups are automatically generated based on the children's index in order to put them in tabs and prevent conflicts between props.

Also, it fix the documentation page issue in storybook/addon-knobs.

Maybe it would be possible to customize these names to make groups more verbose.

Fix. #71

@bastienrobert
Copy link
Author

About this:

Maybe it would be possible to customize these names to make groups more verbose.

Maybe we could read a props on children components (like __groupId) in the stories to get more verbose names?

@bastienrobert
Copy link
Author

bastienrobert commented Mar 22, 2020

Seems like I'm having another issue when using addon-docs. If component is not wrapped, it doesn't receive props properly in the doc page.
I have to do something like:

const Wrapper = (props) => <MyComponent {...props} />

export const Story = () => <Wrapper foo="bar" />

I just don't understand why it does have this behavior.

@ndelangen
Copy link
Contributor

Could you merge in the base branch please?

@bastienrobert
Copy link
Author

I just did it @ndelangen but maybe it'll be necessary to check this : #75 (comment) and to fix this : #75 (comment) ?

@ndelangen
Copy link
Contributor

ndelangen commented Apr 3, 2020

That's strange, that behavior should just work, I think you're using CSF there?

@bastienrobert
Copy link
Author

bastienrobert commented Apr 3, 2020

Yes I am. I just wanted to start with a basic setup before looking to make it works with MDX Syntax (because I'm using Typescript).

Maybe another PR to add more documentation on how to setup Storybook docs with Typescript and MDX here storybook docs could be cool ?

@ndelangen
Copy link
Contributor

@shilman is working on a replacement for knobs that has this auto-feature built-in btw.

Any PR improving the docs would be welcome!

@bastienrobert
Copy link
Author

bastienrobert commented Apr 3, 2020

Ok, that's cool! Maybe you have a date for a release? 🙃

@ndelangen
Copy link
Contributor

6.0.0 is scheduled for release next month or so. It depends on how many bugs we find during prereleases.

@nikshevchenko
Copy link

Hi, folks! Can you talk about the status of this PR? I using 6.0.2 but I have the same problems with my multiple components.

@chriszarate
Copy link
Contributor

Just a note that Storybook v6 and @storybook/addon-essentials have been released, including the "Controls" addon. You can think of Controls as smart knobs, with the added benefit that they can be embedded on Docs pages using ArgsTable.

I am not a maintainer, but I'd consider this addon effectively dead since Controls have resolved all open issues I had with Smart Knobs (including this one) and leapfrogged it in terms of functionality.

@bastienrobert
Copy link
Author

I agree with @chriszarate, this PR is clearly useless for v6 because this addon is useless for v6.

@nikshevchenko I don't think having multiple components in the same story is a good practice. Is your code opensource or could you setup a bug repro? Can't help without more informations.

@ndelangen is this repo going to be archived or do you want to keep it active? Maybe this question should be in another issue?

@ndelangen
Copy link
Contributor

@bastienrobert I think it's best archived, I'll ask @shilman

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

Successfully merging this pull request may close these issues.

5 participants