-
-
Notifications
You must be signed in to change notification settings - Fork 24
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 JSX pragma for better integration with React #3
Comments
Unlike in most existing solutions, the |
I have mixed opinions on the
You mention passing the Also, as a developer using this (or any css prop library), to support
This is the bigger issue to me. I think it's too much of a mental disconnect using both the I like to use a css toolkit (like tailwind, basscss) and then add "custom" css as needed with a css prop. I think if you're using any css classes, you shouldn't use the css prop. They don't compose as well and feel too disconnected. Instead, use classnames (or make your own class-composition-helper). |
Thank you for this interesting library! Personally I'm largely in favour of the I recently commented on the emotion repository about this. The relevant parts are:
For me personally it comes down to:
|
Thank you for these detailed thoughts. The For example, when component A |
So you mean something like this? function A() {
return <B className={css({padding: 16})} />;
}
function B({className}) {
return <p className={css({padding: 0}, className)}>B</p>;
} Now the I guess handling shorthands is something that makes this a bit tricky, e.g.: css(
{paddingLeft: 0},
css({paddingTop: 5}),
css(
{padding: 10},
css({paddingBottom: 20})
)
);
// Result: `padding: 5px 10px 10px 0`; This is of course an extreme case, but API-wise this would make sense to me 🙂. |
Shorthands are hard to handle. I’m not quite sure about how they should be managed. Composition feels a bit unnatural for atomic CSS. Your idea sounds awesome, but it seems to be very hard to implement. |
It seems this could be done with a Babel macro. As for ideas about resolving composition, please see issue #47. |
Motivation
Inspired by Emotion, a
css
prop could be attached to JSX elements for better composition possibilities.Basic example
Details
For compatibility purposes, the React Classic Runtime of Babel should be supported.
The text was updated successfully, but these errors were encountered: