-
Notifications
You must be signed in to change notification settings - Fork 538
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
Migrate Details component to TSX #1026
Conversation
🦋 Changeset detectedLatest commit: c272660 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/primer-components/lxkt71sva |
src/__tests__/Details.tsx
Outdated
@@ -92,7 +93,7 @@ describe('Details', () => { | |||
|
|||
it('Does not toggle when you click inside', () => { | |||
const Component = () => { | |||
const {getDetailsProps} = useDetails({closeOnOutsideClick: true, defaultOpen: true}) | |||
const {getDetailsProps, open} = useDetails({closeOnOutsideClick: true, defaultOpen: true}) | |||
return ( | |||
<Details {...getDetailsProps}> |
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.
Interesting. It looks like none of the Details tests are using the getDetailsProps
function correctly. They all need to updated to call the function and pass the return value to the Details component:
<Details {...getDetailsProps}> | |
<Details {...getDetailsProps()}> |
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.
You'll also probably need to update the prop type of Details to accept the return value of getDetailsProps
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.
Tried to accomplish this in 57dafdd and I'm getting a TS error. About to sign off here, but I might sync up with you in the morning to see if we can take a look at that.
Co-authored-by: Cole Bemis <colebemis@github.com>
Co-authored-by: Cole Bemis <colebemis@github.com>
Co-authored-by: Cole Bemis <colebemis@github.com>
This PR migrates the
Details
component anduseDetails
hook to TypeScript as part of the TypeScript refactor.