-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Manager: Add options to hide sidebar and toolbar per story #29516
base: next
Are you sure you want to change the base?
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 84a0da2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17 file(s) reviewed, 12 comment(s)
Edit PR Review Bot Settings | Greptile
| **showSidebar** | Function | Toggle visibility for the sidebar | `({ storyId }, defaultValue) => storyId === 'landing' ? false : defaultValue` | | ||
| **showToolbar** | Function | Toggle visibility for the toolbar | `({ viewMode }, defaultValue) => viewMode === 'docs' ? false : defaultValue` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Example values should include type annotations to match the function signatures in the code
@@ -108,8 +113,10 @@ const useLayoutSyncingState = ({ | |||
? internalDraggingSizeState | |||
: managerLayoutState; | |||
|
|||
const customisedNavSize = api.getNavSizeWithCustomisations(navSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this fails in CI, as I've added the signature to the SubAPI for layout. Any advice on what I did wrong?
## TODO layout customisation doc | ||
|
||
TODO: | ||
1. Document both functions with use cases | ||
2. Add caveat about bricking the user experience by hiding sidebar everywhere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sidnioulz, could you ping me when you finish adding the documentation so that I can review it properly and help you get this in?
Let me know and we'll go from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonniebigodes thanks, I had totally forgotten about this bit. I've updated it to integrate the new config options in your existing docs, and added a Sidebar UI
section with both the showSidebar options/API and the keyboard shortcut doc which was missing.
I've placed a warning about not using showSidebar
without an alternative means of nav everywhere where it's mentioned.
Closes #22081.
Context
What I did
What's left to do
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
code/.storybook/manager.tsx
with the snippet belowyarn storybook:ui
The snippet:
Documentation
If you are deprecating/removing a feature, make sure to updateMIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
This PR adds layout customization options to conditionally show/hide the Storybook toolbar and sidebar based on story context, primarily addressing the need to hide toolbars on documentation pages.
layoutCustomisations
object in manager config withshowSidebar
andshowToolbar
functionsgetShowToolbarWithCustomisations
andgetNavSizeWithCustomisations
in layout module to handle visibility logictoolbar.mdx
explaining conditional toolbar visibility featuresLayout
andPreview
components to integrate customization logic through API propsaddons.ts
andapi.ts