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

[PAR-473] Pass through components from react-responsive and remove custom Responsive components #942

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

bseverino
Copy link
Contributor

BREAKING CHANGE

This removes custom Responsive components in favor of passing through components from react-responsive directly.

Components that have been removed:

  • ExtraSmall
  • Small
  • Medium
  • Large
  • ExtraLarge
  • ExtraExtraLarge
  • LargerThanExtraSmall

New passthrough components/hooks:

  • MediaQuery
  • useMediaQuery
  • ResponsiveContext

Supporting information

@bseverino bseverino requested a review from a team as a code owner December 15, 2021 18:11
- ExtraExtraLarge
- LargerThanExtraSmall

We will pass through the following components from react-responsive:
Copy link
Member

Choose a reason for hiding this comment

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

nit: useMediaQuery and ResponsiveContext aren't really components, as they are a hook and context respectively. Maybe this line instead says, "...the following components and functionality from react-responsive:"?

@@ -0,0 +1,49 @@
14. Removal of Custom Responsive Components
Copy link
Member

Choose a reason for hiding this comment

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

🔥 Thanks for the ADR!

@@ -1,9 +1,12 @@
import React from 'react';
import Responsive from 'react-responsive';
export {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than having these exported from Responsive/index.jsx, I might lean towards having src/index.js be responsible for the exports from react-responsive.

That would leave just the breakpoints in this file, at which point these could probably be moved to its own standalone file src/utils/breakpoints.js.

The Paragon components that make use of react-responsive could then still get their responsive imports directly from react-responsive itself, which is likely a bit more clear and understandable.

Curious to get to get your take, of course! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that structure makes a lot more sense - thanks!

@bseverino bseverino force-pushed the bseverino/responsive branch from 4bf171c to 0e1a1dc Compare December 15, 2021 23:35
and remove custom Responsive components

BREAKING CHANGE: Custom Responsive components have
been removed in favor of passing through components
and functionality from react-responsive directly.

Components that have been removed:
- `ExtraSmall`
- `Small`
- `Medium`
- `Large`
- `ExtraLarge`
- `ExtraExtraLarge`
- `LargerThanExtraSmall`

New passthroughs:
- `MediaQuery`
- `useMediaQuery`
- `ResponsiveContext`

Please refer to
[react-responsive](https://www.npmjs.com/package/react-responsive)
documentation for more information.
@bseverino bseverino force-pushed the bseverino/responsive branch from 0e1a1dc to ffc39a4 Compare December 16, 2021 18:13
@bseverino bseverino merged commit cc01f21 into master Dec 16, 2021
@bseverino bseverino deleted the bseverino/responsive branch December 16, 2021 18:24
@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 17.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants