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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Update Button types to allow for no children on iconOnly buttons #23735

Merged
merged 4 commits into from Aug 7, 2023

Conversation

cdedreuille
Copy link
Contributor

What I did

I improved the types of the new Button component to allow for iconOnly buttons to not have children.

How to test

  1. Run this branch locally
  2. Test the Button anywhere with <Button iconOnly icon={<><>} />
  3. You should not see any typescript errors

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]

馃 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>

@cdedreuille cdedreuille added maintenance User-facing maintenance tasks ci:normal patch:no labels Aug 7, 2023
@cdedreuille cdedreuille self-assigned this Aug 7, 2023
@cdedreuille cdedreuille changed the title Update Button types to allow for no children on iconOnly buttons UI: Update Button types to allow for no children on iconOnly buttons Aug 7, 2023
onClick?: () => void;
disabled?: boolean;
active?: boolean;
}

type ButtonIconOnlyProps = {
iconOnly?: true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should not be optional in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I made it mandatory.

Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

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

LGTM!

@kasperpeulen kasperpeulen merged commit f21fde3 into next Aug 7, 2023
53 checks passed
@kasperpeulen kasperpeulen deleted the charles-update-button-types branch August 7, 2023 08:45
@github-actions github-actions bot mentioned this pull request Aug 7, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:normal maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants