Sidnioulz / storybook-addon-tag-badges

Display Storybook tags as badges in the sidebar and toolbar.
MIT License
20 stars 1 forks source link

Support 'group' entries in sidebar? #20

Open Sidnioulz opened 1 week ago

Sidnioulz commented 1 week ago

I also have for stories that include the meta with documentation (+ stories) but also include some manual .mdx files with code examples. I noticed that for these folders, the tags also don't show up.

(but maybe that's an odd setup I use..)

(for these 'groups' the icon is also a folder, instead of the component square icon) image

Originally posted by @Fedduh in https://github.com/Sidnioulz/storybook-addon-tag-badges/issues/15#issuecomment-2482303149

Sidnioulz commented 1 week ago

@Fedduh the problem we have with this issue is that 'group' entries don't have a tags definition in the sidebar.

For component entries, we agreed with the Storybook core team to define their tags as the intersection of their contents' tags... which coincides with what you define in the meta export of a CSF.

For group entries like yours, I suspect the MDX pages would not have associated tags. So, the intersection of tags for all group entries would be empty.

@shilman I'm curious if there's a good way to define metadata like tags on freeform MDX entries? If there is such a mechanism, I could try to extend the logic we used for component to group HashEntries.

shilman commented 1 week ago

@Sidnioulz it's probably this PR from a long time ago that I forgot about. Will try resurrecting it now https://github.com/storybookjs/storybook/pull/26633

shilman commented 1 week ago

@Sidnioulz Resurrected here https://github.com/storybookjs/storybook/pull/29655 and it should already be supported in the index

Sidnioulz commented 1 week ago

@shilman thanks!

When I get round to addressing this, I'll open a PR to extend the tags intersection logic to group entries then.

Sidnioulz commented 1 week ago

I've opened the PR on the Storybook side. Once it's merged, I'll be able to make the necessary changes: