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

Adds "useCurrentBreakpoints" hook #318

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kettanaito
Copy link
Owner

@kettanaito kettanaito commented Apr 6, 2020

Changes

  • Adds useCurrentBreakpoints hook

Issues

Release version

  • internal (no release required)
  • patch (bug fixes)
  • minor (backward-compatible changes)
  • major (backward-incompatible, breaking changes)

Contributor's checklist

  • My branch is up-to-date with the latest master
  • I ran yarn verify to see the build and tests pass
  • Remove the useBreakpointChange hook

/**
* Returns a list of breakpoints that match the current state of the viewport.
*/
export default function useCurrentBreakpoints(): string[] {
Copy link
Owner Author

@kettanaito kettanaito Apr 6, 2020

Choose a reason for hiding this comment

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

Returning a list of breakpoint names, because it's possible for multiple breakpoints to match a single state of the viewport:

Layout.configure({
  breakpoints: {
    portrait: {
      orientation: 'portrait'
    },
    mobile: {
      maxWidth: 576
    }
  }
})

On a viewport with the width of 500px both portrait and mobile breakpoints would match.

@kettanaito kettanaito added the needs:discussion Further information is requested label Apr 9, 2020
@kettanaito
Copy link
Owner Author

kettanaito commented Apr 9, 2020

I'm currently in doubt whether this hooks bears any user value. Discussion in #279

@kettanaito kettanaito mentioned this pull request Apr 11, 2020
3 tasks
@kettanaito kettanaito force-pushed the hooks/use-current-breakpoint branch from d766304 to dfaa1e8 Compare April 12, 2020 10:22
@kettanaito kettanaito removed the needs:discussion Further information is requested label Apr 12, 2020
@kettanaito kettanaito force-pushed the hooks/use-current-breakpoint branch from dfaa1e8 to 991e8aa Compare May 27, 2020 07:39
@kettanaito kettanaito force-pushed the hooks/use-current-breakpoint branch from 991e8aa to 7513b27 Compare May 27, 2020 07:52
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.

Add "useBreakpoint" hook
1 participant