-
-
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
CSF: Update docs for using globals in viewports and background addons #28716
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit d220802. 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.
LGTM
14 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
We need to make it more clear that these new docs require the feature flag to be set. There are docs for that but those feature flags but AFAICT they are completely disconnected from the addon docs
docs/essentials/backgrounds.mdx
Outdated
|
||
Default background color. Must match the `name` property of one of the [available colors](#values). | ||
Type: `Record<string, { name: string; value: string }>` |
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.
Should name be optional?
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.
Do you have a reason for making it optional?
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.
So that it can default to the key if unset
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.
But why? Why have 2 ways to configure things?
By just having 1 way, it's clearer for us, clearer for users, less docs to write, less complexity in code, less potential for bugs.
I think we should enforce there to be a name prop, that's purely presentational and separate from the identifier.
If we support both, there's a good chance users won't even know about the name prop at all, and try to hack things in the key instead. Which could cause bugs, with character escaping.
I strongly believe we should strive for simplicity, rather than terseness.
docs/essentials/viewport.mdx
Outdated
name: string, | ||
styles: { height: string, width: string }, | ||
type: 'desktop' | 'mobile' | 'tablet', | ||
}, | ||
type: 'desktop' | 'mobile' | 'tablet' | 'other', |
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.
What does 'other' refer to?
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 know. but it was already there in the types.
Seemed correct to just repeat here what the types had.
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.
It possibly is a value to indicate "don't display an icon at all"?
There are a bunch of fixes in this PR like disable => disabled. Can you please split those into a separate PR that we can patch back to the live docs? |
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.
@ndelangen, thank you for taking the time to put together this pull request and help document this new feature. I appreciate it 🙏 ! This is looking great. I left some small items for you to look into when you have a moment.
Also, one quick question for you. In the viewport example, you're using the isRotated: false
option and I was wondering if this is a new available option, and if so, we'll need to include it in the corresponding table, alongside any other items that were introduced, so that users will know what's available. Wouldn't you agree?
Can you list all the ones you would want patched? I've asked @jonniebigodes to find a good way to ensure this docs change lands in such a way it's clear the feature flag is required. The example you listed is a implementation-change i made in the PR: #26654 |
This is effectively the
|
Co-authored-by: jonniebigodes <joaocontadesenvolvimento@gmail.com>
Co-authored-by: jonniebigodes <joaocontadesenvolvimento@gmail.com>
…rybookjs/storybook into norbert/globals-docs-changes
OK I misunderstood the docs change. Please ignore that request. |
- Improve feature flag callouts - Add API details to migration notes and clarify examples - Restructure guides to use sub-heading structure instead of snippet tabs - Offers ability to explain differences between APIs more thoroughly - Also a better experience, because users' tab preference will not apply across snippets - Clarify example snippets - Only demonstate one concept per snippet - Adjust heading levels - Add globals API reference section - Improve snippet filenames - Remove redundant `storybook-` prefix - Prose tweaks
* next: Address feedback Address comments Typo Further updates Address feedback Remove TK Futher updates to #28716
- Improve feature flag callouts - Add API details to migration notes and clarify examples - Restructure guides to use sub-heading structure instead of snippet tabs - Offers ability to explain differences between APIs more thoroughly - Also a better experience, because users' tab preference will not apply across snippets - Clarify example snippets - Only demonstate one concept per snippet - Adjust heading levels - Add globals API reference section - Improve snippet filenames - Remove redundant `storybook-` prefix - Prose tweaks
Related: #27705
What I did
I updated the docs to be in sync with the changes made here:
#26654
I've requested @jonniebigodes's help with the following:
Adjust this PR in such a way that it becomes clear the new behavior is only so, when the featureFlags are turned on.
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/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
Updated documentation to reflect new API for configuring globals in viewports and backgrounds addons.
docs/_snippets/my-component-story-configure-viewports.md
: Replacedviewports
anddefaultViewport
withoptions
andvalue
, moved configuration toglobals
.docs/_snippets/storybook-addon-backgrounds-configure-backgrounds.md
: Changed background configuration to use anoptions
object.docs/_snippets/storybook-addon-backgrounds-disable-backgrounds.md
: Updatedbackgrounds
parameter fromdisable
todisabled
.docs/api/main-config/main-config-features.mdx
: AddedviewportStoryGlobals
andbackgroundsStoryGlobals
options.code/package.json
: Bumpedvitest
dependency from^1.2.2
to^1.6.0
.