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

fix: use sorted breakpoints in useBreakpoint #5576

Merged
merged 3 commits into from Feb 17, 2022
Merged

Conversation

TimKolberger
Copy link
Contributor

@TimKolberger TimKolberger commented Feb 14, 2022

Closes 5555 (not yet. The CSS responsive object uses media min queries, where as the useBreakpoint uses minmax queries)

📝 Description

Fixed an issue where the hook useBreakpoint did not work as expected with custom breakpoints

⛳️ Current behavior (updates)

useBreakpoint used user defined values from the theme. It is operating on an unsorted object.

🚀 New behavior

It uses the processed and sorted breakpoints from toCSSVar(theme).

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2022

🦋 Changeset detected

Latest commit: 60fc221

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

This PR includes changesets to release 55 packages
Name Type
@chakra-ui/media-query Patch
@chakra-ui/utils Patch
@chakra-ui/react Patch
@chakra-ui/skeleton Patch
@chakra-ui/accordion Patch
@chakra-ui/alert Patch
@chakra-ui/avatar Patch
@chakra-ui/breadcrumb Patch
@chakra-ui/button Patch
@chakra-ui/checkbox Patch
@chakra-ui/clickable Patch
@chakra-ui/close-button Patch
@chakra-ui/color-mode Patch
@chakra-ui/control-box Patch
@chakra-ui/counter Patch
@chakra-ui/editable Patch
@chakra-ui/react-env Patch
@chakra-ui/focus-lock Patch
@chakra-ui/form-control Patch
@chakra-ui/hooks Patch
@chakra-ui/icon Patch
@chakra-ui/image Patch
@chakra-ui/input Patch
@chakra-ui/layout Patch
@chakra-ui/live-region Patch
@chakra-ui/menu Patch
@chakra-ui/modal Patch
@chakra-ui/number-input Patch
@chakra-ui/pin-input Patch
@chakra-ui/popover Patch
@chakra-ui/portal Patch
@chakra-ui/progress Patch
@chakra-ui/provider Patch
@chakra-ui/radio Patch
@chakra-ui/select Patch
@chakra-ui/skip-nav Patch
@chakra-ui/slider Patch
@chakra-ui/spinner Patch
@chakra-ui/stat Patch
@chakra-ui/styled-system Patch
@chakra-ui/switch Patch
@chakra-ui/system Patch
@chakra-ui/table Patch
@chakra-ui/tabs Patch
@chakra-ui/tag Patch
@chakra-ui/textarea Patch
@chakra-ui/theme-tools Patch
@chakra-ui/theme Patch
@chakra-ui/toast Patch
@chakra-ui/tooltip Patch
@chakra-ui/transition Patch
@chakra-ui/visually-hidden Patch
@chakra-ui/props-docs Patch
@chakra-ui/test-utils Patch
@chakra-ui/icons 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 14, 2022

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/chakra-ui/chakra-ui-storybook/8YjM5VTKdpWhY8Sr8whUacvjiAPU
✅ Preview: https://chakra-ui-storybook-git-fix-use-breakpoint-chakra-ui.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 14, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 60fc221:

Sandbox Source
create-react-app-ts Configuration
wonderful-payne-ndio2 Issue #5555

@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2022

📦 A new release has been made for this pull request

To play around with this release, you can install @chakra-ui/react@0.0.0-pr-202212011232 in your project

Latest commit: 60fc221

Copy link
Member

@cschroeter cschroeter left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@nikolovlazar nikolovlazar left a comment

Choose a reason for hiding this comment

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

👌

@TimKolberger
Copy link
Contributor Author

Just before merging I reviewed the file again, and I did not understand immediately what was going on. So I rewrote the whole hook and reused the breakpoint logic from the theme breakpoints. And I fixed a bug on the way there.

Can I request a review again @nikolovlazar and @cschroeter? 💖

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