-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add ThemeProvider #200
Add ThemeProvider #200
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return React.createElement(ThemeProvider, { | ||
children: React.createElement(Story), | ||
}); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Story) => { | |
return React.createElement(ThemeProvider, { | |
children: React.createElement(Story), | |
}); | |
}, | |
(Story) => ( | |
<ThemeProvider> | |
<Story /> | |
</ThemeProvider> | |
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to but I've got this error from storybook:
[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .cjs file format, or if it's an asset, add "**/*.cjs" to `assetsInclude` in your configuration.
Plugin: vite:import-analysis
File: /Users/kzuraw/Developer/macaw-ui/.storybook/preview.cjs:19:21
17 | <ThemeProvider>
18 | <Story />
19 | </ThemeProvider>
| ^
20 | ),
21 | ];
src/theme/provider.tsx
Outdated
import { defaultLightTheme } from "./defaultLight.css"; | ||
|
||
type ThemeProviderProps = { | ||
children?: React.ReactNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO children should be undefined in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so why not use like this
children: React.ReactNode;
}, | ||
defaultCondition: "mobile", | ||
properties: { | ||
display: ["none", "flex"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to defined list of all supported option here? E.g. grid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - for now I've added only flex
but in the future we should add other displays as well 😄
"@vanilla-extract/css": "^1.9.2", | ||
"@vanilla-extract/recipes": "^0.3.0", | ||
"@vanilla-extract/sprinkles": "^1.5.1" | ||
"@vanilla-extract/sprinkles": "^1.5.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vanilla is only a dev tool, we don't need this in the runtime i guess, so please move it to dev deps
src/components/Box/Box.tsx
Outdated
@@ -0,0 +1,4 @@ | |||
import { createBox } from "@dessert-box/react"; | |||
import { sprinkles } from "../../theme"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider to use aliases
b9bd878
to
4381623
Compare
Fixes: #195
I've added:
defaultLight
theme that fulfills the contract