styled-components / xstyled

A utility-first CSS-in-JS framework built for React. šŸ’…šŸ‘©ā€šŸŽ¤āš”ļø
https://xstyled.dev
MIT License
2.27k stars 107 forks source link

Incorrect breakpoint with useBreakpoint hook #389

Open YassienW opened 1 year ago

YassienW commented 1 year ago

šŸ› Bug Report

According to the documentation, md breakpoint should be returned at @media (min-width: 768px) { ... }. Instead it triggers at @media (min-width: 769px) { ... }

To Reproduce

Expected behavior

Link to repl or repo (highly encouraged)

https://codesandbox.io/s/confident-tdd-mhwndm?file=/src/App.js

## Binaries:
 - Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
 - Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
 - npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
## npmPackages:
 - @xstyled/styled-components: ^3.6.0 => 3.7.0 
 - styled-components: ^5.3.5 => 5.3.6 
agriffis commented 1 year ago

Here's the problem

https://github.com/gregberge/xstyled/blob/a12e22a4e04f237ae12b8567c544df3a194ee000/packages/core/src/breakpoints.ts#L60

Seems like that line should be >=

quantizor commented 1 year ago

If one of you has time to submit a patch Iā€™m happy to look at it!

YassienW commented 1 year ago

It's simple enough, i'll make some time for it