question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in documentation of theme.breakpoints.down

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When I use this

const useStyles = makeStyles(theme =>
  createStyles({
    inner: {
      color: "blue",
      [theme.breakpoints.down("lg")]: {
        color: "red"
      }
    }
  })
);

then the generated CSS is this:

.makeStyles-inner-17 {
  color: blue;
}
@media (max-width:1919.95px) {
  .makeStyles-inner-17 {
    color: red;
  }
}

Expected Behavior 🤔

theme.breakpoints.value.lg equals 1280, so I expected the generated CSS to be like this:

.makeStyles-inner-17 {
  color: blue;
}
@media (max-width:1280px) {
  .makeStyles-inner-17 {
    color: red;
  }
}

Steps to Reproduce 🕹

Sandbox: https://codesandbox.io/s/nostalgic-frost-m8boc?file=/src/Demo.js

Steps:

  1. Move the border between the source code and the right part of the screen called “Browser”.
  2. Watch a red string that says “The current window width is 1400 … This string should be red when the width of the window is less than or equal to 1280.”
  3. Move the border so that the window becomes wider than 1920
  4. Watch the displayed string turn to blue.

Context 🔦

I am trying to design a responsive web page.

Your Environment 🌎

Tech Version
Material-UI v4.11.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ruhci28commented, Jul 23, 2020

Hii @oliviertassinari i can i work on this .?

0reactions
mattes3commented, Jul 23, 2020

Oh, I see! Then, if both issues are resolved, everything will be fine, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in documentation of theme.breakpoints.down #21892
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
Why the Theme breakpoints in MUI is not working?
In v5, ThemeProvider should be defined at the root of your application and useStyles should not be called before ThemeProvider.
Read more >
Breakpoints - Material UI - MUI
API that enables the use of breakpoints in a wide variety of contexts.
Read more >
How to use the @material-ui/core.useMediaQuery function in ...
To help you get started, we've selected a few @material-ui/core.useMediaQuery examples, based on popular ways it is used in public projects.
Read more >
React-admin - Theming
For instance, you can have a look at the Datagrid CSS documentation. ... const isXSmall = useMediaQuery(theme => theme.breakpoints.down('xs')); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found