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

UI: Add URL parameters to SB to tweak visible UI #17891

Conversation

JonathanKolnik
Copy link
Contributor

@JonathanKolnik JonathanKolnik commented Apr 5, 2022

Issue: UI can not be hidden conditionally

What I did

Add the ability to use a comma-separated list query param:

&toolbarExclude=storybook/docs,storybook/viewport,...

Storybook’s addons all use a slash-separated prefix convention, so it uses a prefix match (i.e. storybook/a11y would match storybook/a11y/panel.

This applies to both tabs in addition to toolbar buttons.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@nx-cloud
Copy link

nx-cloud bot commented Apr 5, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 2317c2a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@JonathanKolnik JonathanKolnik marked this pull request as draft April 5, 2022 21:20
@JonathanKolnik JonathanKolnik force-pushed the jono/ch-1774-add-url-parameters-to-sb-to-tweak branch from 57f8598 to 24c2da2 Compare April 6, 2022 16:02
@JonathanKolnik JonathanKolnik marked this pull request as ready for review April 6, 2022 16:02
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonathanKolnik can you add some QA instructions here to help me kick the tires?

@JonathanKolnik
Copy link
Contributor Author

JonathanKolnik commented Apr 7, 2022

@shilman sorry for not including QA instructions.

If you build any of the examples and apply the query param &toolbarExclude=canvas,fullscreen,[...any other tool/tab id]

you can also tweak the params here in this story https://github.com/storybookjs/storybook/pull/17891/files#diff-49dbf57f9190dc0ee066badd7466c4ed85ac1797dd09fd0d9a42a86b010be845R173

oh also works in the hosted storybooks (still getting used to how meta this is haha) you can see here how the canvas tab is hidden https://5a375b97f4b14f0020b0cda3-lzkxepkwvd.chromatic.com/?path=/story/ui-preview--with-toolbar-exclusions&toolbarExclude=canvas

it's also worth testing the prefix matching like this https://5a375b97f4b14f0020b0cda3-lzkxepkwvd.chromatic.com/?path=/story/ui-preview--with-toolbar-exclusions&toolbarExclude=storybook/

@shilman shilman self-assigned this Apr 7, 2022
@shilman shilman changed the title Add URL parameters to SB to tweak visible UI UI: Add URL parameters to SB to tweak visible UI Apr 8, 2022
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick test & it's looking great.

@shilman
Copy link
Member

shilman commented Apr 8, 2022

@JonathanKolnik can you check chromatic?

@JonathanKolnik
Copy link
Contributor Author

JonathanKolnik commented Apr 8, 2022

@shilman updated by leaving the story the way it was before this branch

@shilman shilman merged commit 4d4b2ed into storybookjs:next Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants