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

Docs don't tell you to use ThemeProvider early enough. #1876

Closed
0-Captain opened this issue Jul 31, 2021 · 3 comments · Fixed by #1877
Closed

Docs don't tell you to use ThemeProvider early enough. #1876

0-Captain opened this issue Jul 31, 2021 · 3 comments · Fixed by #1877
Assignees

Comments

@0-Captain
Copy link

0-Captain commented Jul 31, 2021

Describe the bug
the color value can't be converted to real color
code:
image
product:
image

To Reproduce
Steps to reproduce the behavior:

  1. yarn create next-app --ts
  2. yarn add theme-ui
  3. edit tsconfig.json, add this line
    "jsxImportSource": "theme-ui",
  4. create babel.config.js
module.exports = {
  presets: [
    [
      "next/babel",
      {
        "preset-react": {
          importSource: "theme-ui", // or '@theme-ui/core'
          runtime: "automatic",
          throwIfNamespace: false,
        },
      },
    ],
  ],
};

demo:
https://codesandbox.io/s/reverent-wright-q1u54?file=/src/pages/index.tsx:81-88

@0-Captain 0-Captain changed the title color color don't work Jul 31, 2021
@lachlanjc lachlanjc added bug Something isn't working context-version-mismatch labels Jul 31, 2021
@hasparus
Copy link
Member

Hey @0-Captain, Theme UI doesn't know about your theme yet. You need to pass your theme object to ThemeProvider so the JSX pragma can pick primary from React context.

Take a look at the third paragraph in Getting Started.

https://theme-ui.com/getting-started#getting-started

I made the required change in your CodeSandbox, here it is:

https://codesandbox.io/s/theme-ui-repro-you-gotta-use-provider-bro-hebjd?file=/src/pages/_app.tsx

I'll try to improve the docs so it's more evident.

@hasparus hasparus removed the bug Something isn't working label Jul 31, 2021
@hasparus hasparus changed the title color don't work Docs don't tell you to use ThemeProvider early enough. Jul 31, 2021
@hasparus
Copy link
Member

Hey @0-Captain, I made a small change to the index page and Getting Started section in the docs. (#1877)

Here's the preview of new index page: https://theme-ui-iuu8kzl45-systemui.vercel.app/#create-your-theme
And the same thing in Getting Started: https://theme-ui-iuu8kzl45-systemui.vercel.app/getting-started

Do you think this would be more welcoming to new Theme UI users?

@hasparus hasparus reopened this Jul 31, 2021
@hasparus hasparus self-assigned this Jul 31, 2021
@0-Captain
Copy link
Author

Great, I think it would be better to take the CodeSandbox as an example in the docs

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 a pull request may close this issue.

3 participants