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

Use Storybook Globals API #27

Open
literalpie opened this issue Nov 2, 2024 · 1 comment · May be fixed by #29
Open

Use Storybook Globals API #27

literalpie opened this issue Nov 2, 2024 · 1 comment · May be fixed by #29

Comments

@literalpie
Copy link
Owner

literalpie commented Nov 2, 2024

In storybook 8.3, the globals api was introduced. This seems like the perfect api to reduce the complexity of this addon.

A sketch of what I'm thinking:

  • Make a new global called "addon-rtl"
    • I think this is a better name than "direction" since it's more clearly related to our addon
  • Keep the existing icon button in the toolbar, and call setGlobal when it's toggled. Should we disable the button when a global is set at the story level, like the built-in global toolbar items?
  • For compatibility, we should try to continue to respect url params, events, and story parameters. Maybe keep track of "eventsState" and give that priority over other state. I don't think we should do anything special to support the case where both story parameters and globals are provided.
@literalpie
Copy link
Owner Author

I think trying to keep compatibility with parameters will be annoying. We should just jump to 2.0 even though 1.0 isn't that old.

  • We will disable the button when storyGlobals is set
  • The global will be called addonRtl
  • We can respect URL params, but also the globals api has its own version of url params
  • Events can still work the same as before

WIP branch

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

Successfully merging a pull request may close this issue.

1 participant