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

Custom breakpoints not working #1073

Closed
josbroers opened this issue Feb 12, 2021 · 1 comment
Closed

Custom breakpoints not working #1073

josbroers opened this issue Feb 12, 2021 · 1 comment

Comments

@josbroers
Copy link

josbroers commented Feb 12, 2021

I'm trying to change the default breakpoints, but it's not working. I followed the docs and used ThemeProvider, but Rebass is still using the default breakpoints. Instead of using emotion-theming, I use @emotion/react because of this error:

Error: `emotion-theming` has been removed and all its exports were moved to `@emotion/react` package

I use these versions:

"@emotion/react": "^11.1.5",
"rebass": "^4.0.7"

My code:

_app.js

import { ThemeProvider } from "@emotion/react";

const theme = {
  breakpoints: ["768px", "1024px"]
};

export default function MyApp({ Component, pageProps }) {
  return (
    <ThemeProvider theme={theme}>
      <Component {...pageProps} />
    </ThemeProvider>
  );
}

index.js

import { Box, Flex } from "rebass";

export default function IndexPage() {
  return (
    <Flex flexDirection={["column", "column", "row"]}>
      <Box width={[1, 1, 1 / 2]} marginBottom={[10, 25, 0]}>
        Hello
      </Box>
      <Box width={[1, 1, 1 / 2]}>World</Box>
    </Flex>
  );
}

CodeSandbox

I've also created a sandbox for reproduction: https://codesandbox.io/s/rebass-themeprovider-wcc6b

Expectations

The breakpoints should be 768px and 1024px instead of 40em and 52em.

@josbroers
Copy link
Author

Rebass isn't up-to-date. That's why it isn't working as it should. I'm no longer using Rebass, because of the lack of upgrades... Instead now using TailwindCSS.

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

No branches or pull requests

1 participant