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

Migrate Details component to TSX #1026

Merged
merged 9 commits into from
Feb 11, 2021
Merged

Conversation

VanAnderson
Copy link
Contributor

This PR migrates the Details component and useDetails hook to TypeScript as part of the TypeScript refactor.

@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2021

🦋 Changeset detected

Latest commit: c272660

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

This PR includes changesets to release 1 package
Name Type
@primer/components 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

@vercel
Copy link

vercel bot commented Feb 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/lxkt71sva
✅ Preview: https://primer-components-git-vananderson-migrate-details-to-tsx.primer.now.sh

@vercel vercel bot temporarily deployed to Preview February 8, 2021 21:22 Inactive
src/hooks/useDetails.tsx Outdated Show resolved Hide resolved
@VanAnderson VanAnderson marked this pull request as ready for review February 8, 2021 21:26
@VanAnderson VanAnderson mentioned this pull request Feb 8, 2021
53 tasks
src/hooks/useDetails.tsx Outdated Show resolved Hide resolved
src/hooks/useDetails.tsx Outdated Show resolved Hide resolved
@@ -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}>
Copy link
Contributor

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:

Suggested change
<Details {...getDetailsProps}>
<Details {...getDetailsProps()}>

Copy link
Contributor

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

Copy link
Contributor Author

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>
@vercel vercel bot temporarily deployed to Preview February 8, 2021 23:58 Inactive
VanAnderson and others added 2 commits February 8, 2021 17:58
Co-authored-by: Cole Bemis <colebemis@github.com>
Co-authored-by: Cole Bemis <colebemis@github.com>
@vercel vercel bot temporarily deployed to Preview February 9, 2021 00:02 Inactive
@vercel vercel bot temporarily deployed to Preview February 9, 2021 00:04 Inactive
@vercel vercel bot temporarily deployed to Preview February 9, 2021 01:07 Inactive
@vercel vercel bot temporarily deployed to Preview February 10, 2021 21:41 Inactive
@colebemis colebemis merged commit c976411 into main Feb 11, 2021
@colebemis colebemis deleted the VanAnderson/migrate-details-to-TSX branch February 11, 2021 17:12
@github-actions github-actions bot mentioned this pull request Feb 11, 2021
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