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

Export useResizeObserver from @primer/react #3027

Merged
merged 3 commits into from
Mar 15, 2023
Merged

Conversation

talum
Copy link
Contributor

@talum talum commented Mar 14, 2023

Exporting the useResizeObserver hook from @primer/react so it can be used outside of Primer!

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

Screenshots

n/a

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@talum talum self-assigned this Mar 14, 2023
@changeset-bot
Copy link

changeset-bot bot commented Mar 14, 2023

🦋 Changeset detected

Latest commit: 738c2a5

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 Minor

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 94.48 KB (+0.02% 🔺)
dist/browser.umd.js 95.05 KB (+0.02% 🔺)

@talum talum temporarily deployed to github-pages March 14, 2023 20:09 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3027 March 14, 2023 20:09 Inactive
@talum talum temporarily deployed to github-pages March 14, 2023 20:19 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3027 March 14, 2023 20:19 Inactive
@joshblack
Copy link
Member

Hey @talum! 👋 Thanks so much for taking the time to make a PR for this 🙏

As a rule of thumb, when should we expect things be exported from Primer for hooks like this versus be packages in dotcom? (e.g.: https://gh.io/AAjq3a7) I wasn't sure and just wanted to double-check 👀

@talum
Copy link
Contributor Author

talum commented Mar 14, 2023

@joshblack Great question, and I don't know about the answer! I'm following guidance from this comment: https://github.com/github/primer/issues/1908#issuecomment-1467375326

I would have thought it better to export this from Primer rather than implement a different version in dotcom. Interestingly, I don't even remember finding that in dotcom when I was searching. I definitely could use try using that hook in dotcom instead of exporting this one. What do y'all think?

🤔 Update: I think that one doesn't listen for resizing of a given element. Yeah, that one watches for window resizes whereas I care about resizing a certain element. So I think we do need this and I'd rather import it from a package rather than copying it over.

Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

Thank you! ✨

@joshblack
Copy link
Member

@talum totally! Makes sense 👍

@joshblack joshblack added this pull request to the merge queue Mar 15, 2023
Merged via the queue into main with commit 3153c81 Mar 15, 2023
@joshblack joshblack deleted the export-use-resize-observer branch March 15, 2023 15:56
@primer-css primer-css mentioned this pull request Mar 15, 2023
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.

None yet

3 participants