Skip to content

Conversation

taysea
Copy link
Collaborator

@taysea taysea commented Jun 9, 2022

What does this PR do?

Allows Button as to accept elementType. This is important for cases when someone uses a router like react-router-dom and wants to do something like:

<Button
   as={Link}
   to="/home" (to is the prop for react-router-dom link)
   label="Home"
/>

Where should the reviewer start?

What testing has been done on this PR?

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Yes.

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

@ericsoderberghp
Copy link
Contributor

Do we need anything for index.d.ts?

@taysea
Copy link
Collaborator Author

taysea commented Jun 9, 2022

Do we need anything for index.d.ts?

I don't believe so. Index.d.ts already has as: PolymorphicType defined which includes React.ComponentType<any>;

@ericsoderberghp ericsoderberghp merged commit 52815a5 into grommet:master Jun 9, 2022
@taysea taysea deleted the button-as branch June 9, 2022 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants