-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Addons: Update the Viewport and Background Addon #30841
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
…viewport addon to use modern globals. Clean up related documentation and types.
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.
LGTM
8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
View your CI Pipeline Execution ↗ for commit 991d669.
☁️ Nx Cloud last updated this comment at |
…implify configuration by eliminating backgroundsStoryGlobals feature and related legacy tools. Update documentation accordingly.
…globals instead of parameters
… when set via globals, and ensure the toolbar is disabled accordingly.
…m/storybookjs/storybook into norbert/viewport-background-addon
…ated function type from styles, adjusted viewport configuration in Tool component, and added shorthand example in globals stories.
…t Tool component to handle new data structure.
…te globals stories to use a variable for viewport.
…g related components and stories for improved type safety and consistency.
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.
25 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
…ion for addon viewport and backgrounds, and adjust formatting for consistency.
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.
Looks good except for one nitpick!
Co-authored-by: Valentin Palkovic <[email protected]>
What I did
This pull request includes significant changes to the
viewport
addon in Storybook, focusing on removing legacy code and simplifying the configuration. The most important changes include the removal of theviewportStoryGlobals
feature flag, deletion of legacy code, and updates to the configuration and documentation.Removal of legacy code:
code/addons/viewport/src/legacy/ToolLegacy.tsx
: EntireToolLegacy
component removed, which included various functions and interfaces related to the viewport addon.code/addons/viewport/src/legacy/ViewportAddonParameter.ts
: Removed theViewportAddonParameter
interface.Configuration updates:
code/.storybook/main.ts
: RemovedviewportStoryGlobals
from thefeatures
configuration.code/addons/viewport/src/manager.tsx
: Updated theaddons.register
method to always useViewportTool
and removed the conditional rendering ofViewportToolLegacy
.code/addons/viewport/src/preview.ts
: Simplified theinitialGlobals
export by removing the legacy configuration.code/core/src/types/modules/core-common.ts
: Removed theviewportStoryGlobals
feature flag from theStorybookConfigRaw
interface.Documentation updates:
docs/api/main-config/main-config-features.mdx
: Removed the section describing theviewportStoryGlobals
feature flag.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.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 modernizes the Viewport and Background addons by removing legacy implementations and standardizing configuration approaches for both addons.
ViewportToolLegacy
,BackgroundSelectorLegacy
, and related components, consolidating functionality into modern versionsviewportStoryGlobals
andbackgroundsStoryGlobals
feature flags fromStorybookConfigRaw
, making modern behavior the defaultConfig
with specificViewportParameters
andBackgroundsParameters
types