-
Notifications
You must be signed in to change notification settings - Fork 4.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
RangeControl: Refactor stories to use Controls #39357
Conversation
color: { control: { type: 'color' } }, | ||
disabled: { control: { type: 'boolean' } }, | ||
help: { control: { type: 'text' } }, | ||
marks: { control: { type: 'object' } }, | ||
min: { control: { type: 'number' } }, | ||
max: { control: { type: 'number' } }, | ||
railColor: { control: { type: 'color' } }, | ||
showTooltip: { control: { type: 'boolean' } }, | ||
step: { control: { type: 'number' } }, | ||
trackColor: { control: { type: 'color' } }, | ||
withInputField: { control: { type: 'boolean' } }, |
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.
As always, most of these lines will be unnecessary when the TypeScript conversion is done.
Size Change: +2.05 kB (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
1cc44ef
to
6a4f4bb
Compare
* Setting the `step` prop to `"any"` will allow users to select non-integer values. | ||
* This also overrides both `withInputField` and `showTooltip` props to `false`. | ||
*/ | ||
export const WithAnyStep = ( 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 use RangeControlWithState
instead? (in that case, the additional initialValue
prop would actually come in handy)
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 kind of thought it was useful to have the current value showing for this example, otherwise it's impossible to see that it's a float.
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.
That is a good point. I had forgotten about this 😅 Let's leave it as-is
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 🚀
Love how much more accessible these stories are for a consumer of this package
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 agree with removing the multiple
story and the addition of a the value to the WithAnyStep
story. It all looks good to me.
Maybe this issue isn't the greatest place to bring it up but I'd love to know if Ladle is on the your radars. I've only just seen it and hope it might be something we could consider. I've long had grief with Storybook for how slow it is. |
It wasn't! Good to see some healthy competition going on, especially on the performance front. Ladle in its current state won't quite work for us since we're leaning into the auto-generated docs angle (for example here) as we do more TypeScript migrations. One big bottleneck for me is the package building on the Gutenberg side. The Lines 292 to 293 in 8abfa33
I'm hoping that Story Store v7 might give us a perf boost though. |
Thanks for the tip on Storybook and your quick take on Ladle. Support for docs is said to have been started tajo/ladle#58 (comment) so we'll see. |
* RangeControl: Refactor stories to use Controls * Remove unused `initialValue` * Add control for `initialPosition`
Part of #35665
In preparation for #38720
What?
Reworks the Storybook stories for
RangeControl
to use Controls instead of Knobs.Notable changes
Multiple
story (I don't think it currently has a clear purpose)Why?
Better docs, and easier composition of stories.
Testing Instructions
npm run storybook:dev
and see the Docs tab for theRangeControl
component. The reworked stories should be understandable, and capture the intent of the original stories.