-
Notifications
You must be signed in to change notification settings - Fork 208
Glamor css prop w/ glamorous fails PropType validation #332
Comments
That's rather problem with |
No, it's not a problem. This is a known issue. I'm on my phone so I can't explain well, but basically glamor gives back an object that has a toString method that returns the class name. There are good reasons for this. I think our solution should be to accept an object as part of the prop-types. It's not "correct" but I don't think it's worth being correct in this situation because it causes more confusion than anything. Want to update the prop types to accept both an object as well as a string? |
Having rule as an object is important in <El {...css()}/> and this: <El className={css()}> but in TIL: Anyways import { Div } from "glamorous"
const El = <Div css={{ textDecoration: 'underline' }}>glamor css prop</Div> which is more flexible, ie you can do: const ElVariant = glamorous(El)(styles) which gives you one class with merged props. |
Actually, if you can use In any case, I've solved this issue in #333. Could use a review. |
Yeah, |
Hi there!
glamorous
version: 4.9.2glamor
version: 2.20.40react
version: 15.6.1Relevant code.
What you did:
I've been using glamor + glamorous and I recently discovered glamor's
css
prop (https://github.com/threepointone/glamor/blob/master/docs/createElement.md). It's awesome! However, I've found that it doesn't play well withglamorous
.What happened:
Reproduction:
Here's a reproduction in codesandbox: https://codesandbox.io/s/mqqq7k5z18
I also made this repo before I realized I could use codesandbox: https://github.com/Tibfib/glamor-glamorous-css-bug
Problem description:
When using both glamorous and glamor's
css
prop there is a PropTypes validation error. For all I can tell it works perfectly–it just complains about PropTypes.I do think there's a use case for using both glamorous and the css prop.
Suggested solution:
Play nicely with
glamor
's CSS prop. I think this is aglamorous
issue but it could be an issue with howglamor
does thecss
prop.Thanks for reading!
The text was updated successfully, but these errors were encountered: