-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
UI: Allow showing or hiding the addon panel #32348
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
Conversation
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.
6 files reviewed, 2 comments
|
View your CI Pipeline Execution ↗ for commit f71856f
☁️ Nx Cloud last updated this comment at |
f4da5bc to
8866976
Compare
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a customizable showPanel control across manager API and UI: introduces API_LayoutCustomisations.showPanel, a SubAPI method getShowPanelWithCustomisations, integrates it in Layout rendering to compute panel visibility, updates addon config typing to layoutCustomisations with showPanel, and documents usage with examples and guides. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as User
participant Layout as Manager UI Layout
participant API as Manager SubAPI (layout)
participant State as Manager State
participant CustomFn as layoutCustomisations.showPanel
User->>Layout: Navigate/change story
Layout->>API: getShowPanelWithCustomisations(isPanelShown)
API->>State: Read state.layoutCustomisations.showPanel
alt Custom function provided
API->>CustomFn: invoke(state, defaultValue)
CustomFn-->>API: boolean | undefined
alt returns boolean
API-->>Layout: customised boolean
else returns undefined/null
API-->>Layout: defaultValue
end
else No custom function
API-->>Layout: defaultValue
end
Layout->>Layout: Compute grid areas based on showPanel/panelPosition
Layout-->>User: Render with/without addon panel
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment |
| layoutCustomisations?: { | ||
| showPanel?: API_LayoutCustomisations['showPanel']; |
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 believe there was an error in the previous commit introducing layoutCustomisations and this should be the correct API key.
@ndelangen seeing as you know the API, do you agree this is correct?
Closes #14442
What I did
Added the same API endpoint for the addon panel as for the sidebar and toolbar, so it can be hidden for specific stories.
This makes sense for documentation workflows, for kitchen sink stories where all variants are grouped together, and for some real-world showcase stories with fixed args.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Caution
Not automatically tested. Same as for
showSidebarandshowToolbar, we no longer have good examples on how to test the whole manager UI with a mocked API like we had in SB 7.Manual testing
code/.storybook/manager.tsx:code/core/src/components/components/IconButton/IconButton.stories.tsxon line 12Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH 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.tsMake 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/coreteam 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>Summary by CodeRabbit