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

fix(Banner): rewrite PrimaryAction & SecondaryAction types #5055

Conversation

francinelucca
Copy link
Member

@francinelucca francinelucca commented Oct 1, 2024

Closes https://github.com/github/primer/issues/3967

Modifies the Banner.PrimaryAction and Banner.SecondaryAction component types to solve for current type error when attempting to use as prop.

Changelog

Changed

Updates Banner.PrimaryAction & Banner.SecondaryAction to export as a PolymorphicForwardRefComponent to allow for better type inference and usage of the as prop.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

If desired, you may render a Banner in your local environment to test with:

 primaryAction={<Banner.PrimaryAction as={Link} href="" />}
      secondaryAction={
        <Banner.SecondaryAction as={Link} href="">
          Button
        </Banner.SecondaryAction>
      }

Merge checklist

Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: ced3929

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 1, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 96.78 KB (0%)
packages/react/dist/browser.umd.js 97.08 KB (0%)

{children}
</Button>
)
}
}) as PolymorphicForwardRefComponent<'button', BannerPrimaryActionProps>
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we necessarily care about forwarding a ref here but it's the only way I found to get the type-checking to pass (mimicked Button). Open to suggestions

Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to me, I'd do the same but yeah open to be convinced otherwise 😅

@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/344960

Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

🔥

{children}
</Button>
)
}
}) as PolymorphicForwardRefComponent<'button', BannerPrimaryActionProps>
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to me, I'd do the same but yeah open to be convinced otherwise 😅

…nd-bannersecondaryaction-button-to-support-href
Copy link
Contributor

github-actions bot commented Oct 8, 2024

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 8, 2024
@francinelucca francinelucca added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 8, 2024
@francinelucca francinelucca added this pull request to the merge queue Oct 8, 2024
Merged via the queue into main with commit 73135c1 Oct 8, 2024
48 checks passed
@francinelucca francinelucca deleted the francinelucca/3967-bug-bannerprimaryaction-and-bannersecondaryaction-button-to-support-href branch October 8, 2024 18:09
@primer primer bot mentioned this pull request Oct 8, 2024
@primer primer bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Banner integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member status: review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants