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

UX-288 Add useBreakpoint hook #609

Merged
merged 13 commits into from
Sep 1, 2020
Merged

UX-288 Add useBreakpoint hook #609

merged 13 commits into from
Sep 1, 2020

Conversation

jonambas
Copy link
Contributor

@jonambas jonambas commented Aug 25, 2020

What Changed

  • Initial goal was to show 1 or 2 months on the Datepicker depending on window resize
  • After speaking with @PatrickSison , we realized that initialMonth would have to also change on window resize
  • Instead of implementing hidden internal behavior to transform month, we decided to just export a helper hook so FE can use it on the front end
function Component() {
  const breakpoint = useBreakpoint();
  
  if (breakpoint === 'sm') {
    // do something
  }

  if (breakpoint === 'lg') {
    // do something
  }

  return ...
}

How To Test or Verify

PR Checklist

  • Add the correct type label
  • Pull request approval from #uxfe or #design-guild

@jonambas jonambas changed the title UX-288 Add useBreakpoints hook UX-288 Add useBreakpoint hook Aug 25, 2020
@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #609 into release/minor will increase coverage by 0.27%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                Coverage Diff                @@
##           release/minor     #609      +/-   ##
=================================================
+ Coverage          93.66%   93.93%   +0.27%     
=================================================
  Files                138      138              
  Lines               1783     1782       -1     
=================================================
+ Hits                1670     1674       +4     
+ Misses               113      108       -5     
Impacted Files Coverage Δ
packages/matchbox/src/components/Banner/styles.js 100.00% <ø> (ø)
packages/matchbox/src/components/Table/styles.js 100.00% <ø> (ø)
...ackages/matchbox/src/components/RadioCard/Group.js 100.00% <100.00%> (+8.33%) ⬆️
...kages/matchbox/src/components/DatePicker/styles.js 93.75% <0.00%> (+25.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d61602...4e926f6. Read the comment docs.

@jonambas jonambas changed the base branch from main to release/minor August 26, 2020 13:26
@jonambas jonambas changed the base branch from release/minor to main August 26, 2020 13:30
Copy link
Contributor

@logansparlin logansparlin left a comment

Choose a reason for hiding this comment

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

This looks good

propTables: [DatePicker],
source: false,
text: `
~~~jsx
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, this is cool

@logansparlin logansparlin merged commit 37de896 into main Sep 1, 2020
@jonambas jonambas deleted the UX-288 branch February 18, 2021 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants