-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DropdownMenu: convert Storybook examples from knobs to controls #47149
DropdownMenu: convert Storybook examples from knobs to controls #47149
Conversation
@@ -14,6 +14,8 @@ | |||
- `SandBox`: Convert to TypeScript ([#46478](https://github.com/WordPress/gutenberg/pull/46478)). | |||
- `ResponsiveWrapper`: Convert to TypeScript ([#46480](https://github.com/WordPress/gutenberg/pull/46480)). | |||
- `ItemGroup`: migrate Storybook to controls, refactor to TypeScript ([46945](https://github.com/WordPress/gutenberg/pull/46945)). | |||
- `Toolbar`: unify Storybook examples under one file, migrate from knobs to controls ([47117](https://github.com/WordPress/gutenberg/pull/47117)). |
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.
Forgot to add an entry in #47117, adding it here
Size Change: 0 B Total Size: 1.33 MB ℹ️ View Unchanged
|
Flaky tests detected in 8bfdf6f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3913278425
|
toggleProps: { | ||
showTooltip: true, | ||
}, |
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.
Noting that showTooltip = true
seems to be the default behavior:
showTooltip={ toggleProps?.showTooltip ?? true } |
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.
Yup, done in f8747ec
'Show tooltip on a toggle button', | ||
true | ||
); | ||
const Template = ( props ) => <DropdownMenu { ...props } />; |
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 we set a hardcoded height like in Dropdown
so the popover doesn't get cut off in Docs view?
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.
Great point — d2ed3fd
WithChildren.args = { | ||
label: 'Select a direction.', | ||
icon: more, | ||
children: ( { onClose } ) => ( |
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.
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.
Added custom code snippet in d8b8af7
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.
Ugh, manual snippets look so much nicer. I wish there wasn't such a big increase in maintenance cost.
8bfdf6f
to
d8b8af7
Compare
@mirka this is ready for a final review :) |
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 👍
WithChildren.args = { | ||
label: 'Select a direction.', | ||
icon: more, | ||
children: ( { onClose } ) => ( |
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.
Ugh, manual snippets look so much nicer. I wish there wasn't such a big increase in maintenance cost.
What?
Convert
DropdownMenu
Storybook examples from using knobs (deprecated) to controlsWhy?
The knobs addon is currently blocking using npm 8 (see #46443)
How?
I rewrote the Storybook example, keeping the previous default example intact and adding one more example ("With Children"). I also added more info for the control args, so that all relevant props show in the controls panel.
Testing Instructions
trunk
WithChildren
Storybook example works as expected