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

feat: support storybook composition #17

Open
RobbyRabbitman opened this issue Nov 14, 2024 · 5 comments
Open

feat: support storybook composition #17

RobbyRabbitman opened this issue Nov 14, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request needs info Awaiting information from reporter

Comments

@RobbyRabbitman
Copy link

Hi, thanks for the great addon!

I wonder if displaying the badges in a storybook composition setup is possible - probably not because the host just queries the metadata of the components and stories of the other storybook instances right?

@Sidnioulz Sidnioulz added the enhancement New feature or request label Nov 18, 2024
@Sidnioulz
Copy link
Owner

Hi @RobbyRabbitman!

For sure, tagBadges addons defined on the composed Storybooks would not load (https://storybook.js.org/docs/sharing/storybook-composition says somewhere that composed addons do not get loaded).

I don't know if addons defined on the Storybook instance that loads external stories run everywhere. I also don't know if the sidebar entries go through the same code, and that's something I'd need to try out.

If you have a public repo set up with composition already configured, feel free to share it. It'll save me some time to repro and test.

@RobbyRabbitman
Copy link
Author

Thanks for the reply, I will try it out in the next couple of days but i cannot share it 😄

@Sidnioulz
Copy link
Owner

Thanks! I'm assigning this to you so I know I'm waiting to hear back from you :)

@Sidnioulz Sidnioulz added the needs info Awaiting information from reporter label Nov 23, 2024
@RobbyRabbitman
Copy link
Author

RobbyRabbitman commented Dec 8, 2024

Observation: the badges are shown when the config is also set on the host storybook instance - however I wonder why the output is different. Left=host and Right=Child. Both instances use the framework @storybook/web-components-vite and set exactly the same config, because its in a shared package. I haven't got the time to debug it yet.

export const createHdiComponentTagConfig = (
  ...config: TagBadgeParameters
): {
  [STORYBOOK_ADDON_TAG_BADGES_CONFIG_KEY]: TagBadgeParameters;
} => ({
  [STORYBOOK_ADDON_TAG_BADGES_CONFIG_KEY]: [
    {
      tags: ['preview'] satisfies HdiComponentTag[],
      badge: {
        text: 'Preview',
      },
    },
    ...config,
    ...defaultConfig,
  ],
});

@Sidnioulz
Copy link
Owner

Sidnioulz commented Dec 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs info Awaiting information from reporter
Projects
None yet
Development

No branches or pull requests

2 participants