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

Add a way to mark folders and complete components as having a status #17

Open
jwir3 opened this issue May 12, 2021 · 7 comments
Open

Add a way to mark folders and complete components as having a status #17

jwir3 opened this issue May 12, 2021 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jwir3
Copy link

jwir3 commented May 12, 2021

(See attached screenshot for this to make a bit more sense)

I have the following structure for my components in Storybook:

Atoms
  | --- ComponentName
          | ---- Specific Instance
Molecules
....

Right now, only Specific Instance can have a status. It would be really nice if (probably in the storybook preview.js file), I could specify the status of the ComponentName (the overall component) and Atoms (folder) that the component previews are defined within.

Mostly, I'm just looking for this to be on the left nav bar, so I can see, at a glance, which of my folders is completely finished, and which components I need to work on yet.

image

@gavmck
Copy link
Member

gavmck commented May 13, 2021

Yeah that would be awesome! I spent a good few hours trying to figure out how, but I don't think it's possible right now.

Any ideas?

@deh4g
Copy link

deh4g commented Jun 29, 2021

Hi @etchteam,

It says on the Readme.md that "You'll get an awesome label injected in the top toolbar and the sidebar.".

But if I understand what going on so far this add-on only works for the toolbar, not the sidebar. Correct?

@gavmck
Copy link
Member

gavmck commented Jun 29, 2021

Hi @etchteam,

It says on the Readme.md that "You'll get an awesome label injected in the top toolbar and the sidebar.".

But if I understand what going on so far this add-on only works for the toolbar, not the sidebar. Correct?

@rodneysim we add a status dot label to the sidebar as well here: https://github.com/etchteam/storybook-addon-status/blob/master/src/register.tsx#L29

@gavmck gavmck added enhancement New feature or request help wanted Extra attention is needed labels Nov 10, 2021
@Perni1984
Copy link

@gavmck maybe we can invest some time looking into this problem - what approaches did you try out, which didn't work?

@gavmck
Copy link
Member

gavmck commented Jun 28, 2022

@Perni1984 Looking at the storybook files, I think it might be possible. You get the renderLabel method available on Root/Group/Story so you just need to check if parameters.status is available at that level.

Can't remember why, but we only allow it on stories at the moment: https://github.com/etchteam/storybook-addon-status/blob/master/src/register.tsx#L33

Could just be out of date 🤷

Here is the tree construction file in storybook for reference: https://github.com/storybookjs/storybook/blob/aa74f4f6a05aec74068669d581f0abfa162ff6ec/lib/ui/src/components/sidebar/Tree.tsx

@Perni1984
Copy link

Perni1984 commented Jun 28, 2022

Hey @gavmck thanks for the fast response.

The problem is that storybook only "passes" viewMode and docsOnly parameters if the node is of type group (see https://github.com/storybookjs/storybook/blob/ad3e6f0829a03462102a4834fef9288fd1dddeb9/lib/api/src/lib/stories.ts#L269) - so the status parameter is not available.

I can see 3 options here:

  1. Make a PR to the storybook repo which passes more parameters (the reduced parameters are there very likely by design, so I don't think they will accept it).
  2. Overwrite the renderLabel function on a group level in the story file - so far I have not been succesful on that - I am not sure if this is even possible
  3. Misuse the viewMode Parameter to pass an object which contains the status and make a PR against storybook-addon-status to also read the status out of the viewMode Parameter.

I am not a fan of either one - but would you be happy to accept a PR that goes for 3.? - or do you have any other idea on how to get this done?

@gavmck
Copy link
Member

gavmck commented Jun 28, 2022

Probably best to give 1 a spin first just to make sure, you never know and it's the "real" solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

4 participants