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
feat(core): useStyle
hook
#758
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.
I think you're better off making the change once inside of collectCss
, the helper responsible for aggregating all of the styles into a CSS string. You could append json.style
to its output, which ought to give us support in all generators without changing the code within them.
mitosis/packages/core/src/helpers/styles/collect-css.ts
Lines 80 to 85 in 45c48a5
export const collectCss = (json: MitosisComponent, options: CollectStyleOptions = {}): string => { | |
const styles = collectStyles(json, options); | |
// TODO create and use a root selector | |
return classStyleMapToCss(styles); | |
}; | |
Mind giving that a shot and see if it works without hiccups?
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.
Love this! Can we add 2 component snapshot tests:
- 1 that uses only
useStyle
- 1 that uses
useStyle
and thecss
prop, showing how they get combined.
Co-authored-by: Sami Jaber <jabersami@gmail.com>
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.
Excellent @raymondmuller . Thank you for this new feature!! 🏆
Description
See feature idea discussion here: #757