Skip to content
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

TextControl: Set Storybook control types on help, label and type #45405

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

walbo
Copy link
Member

@walbo walbo commented Oct 30, 2022

What?

  • Set control type on help, label and type in the storybook for the TextControl component.
  • Fix example not showing in the story docs.

Why?

  • The story breaks if you try to add a help or label prop.
  • The example is not showing in the story.

How?

  • Set control type to text on help, label and type props.
  • Remove @example from the example to make it visible in the docs.

Testing Instructions

Open the TextControls story and make sure you can set label, help and type props without the story breaking

Screenshots or screencast

Before After
bug fixed

@walbo walbo added [Package] Components /packages/components Storybook Storybook and its stories for components labels Oct 30, 2022
@walbo walbo requested review from mirka and ciampo October 30, 2022 18:36
@walbo walbo requested a review from ajitbohra as a code owner October 30, 2022 18:36
@codesandbox
Copy link

codesandbox bot commented Oct 30, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@walbo walbo changed the title TextControl: Add storybook control type on help, label and type TextControl: Set Storybook control types on help, label and type Oct 31, 2022
@ciampo ciampo requested a review from chad1008 October 31, 2022 16:50
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

Thank you for your work here!

},
help: { control: { type: 'text' } },
label: { control: { type: 'text' } },
type: { control: { type: 'text' } },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish there was a way to show all the possible input types in a dropdown, rather than allowing any string. But this is definitely a better scenario than the Object control

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Ideally I think the type prop on TextControl should be limited. To me I it doesn't make sense to allow ex type="button" and type="checkbox" here.

However I think that is a discussion for another PR. If you want I can open a PR and we can continue it there.

@walbo walbo merged commit f18d346 into trunk Oct 31, 2022
@walbo walbo deleted the fix/text-control-storybook-help-label-type branch October 31, 2022 18:48
@github-actions github-actions bot added this to the Gutenberg 14.5 milestone Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components Storybook Storybook and its stories for components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants