-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Compose rules with cx/css #355
Labels
Comments
Support multiple declarations on [%css ""](* Current implementation *)
css: string -> Css.Rule
[%css "display: block"] -> display(`block) (* Css.Rule *)
cx: array(Css.Rule) -> string (* hashed className *)
[%cx [| [%css "display: block"] |]] -> style(. [| display(`block) |])
(* Problem *)
%css can't contain more than one property.
It woudn't met the interface of `string -> Css.Rule`. Possible solution IWrap every [%css] with a style() call, making css a string. Cons
Possible solution IIcss: string -> Css.Rule
[%css "display: block"]
(* ----- *)
display(`block)
css: string -> array(Css.Rule)
[%css "display: block; width: 100%"]
(* ----- *)
[|display(`block), width(percent(100.))|] Cons
Possible solution IIITreat all css: string -> [| Css.Rule |]
[%css "display: block"]
(* ----- *)
[| display(`block) |]
css: string -> array(Css.Rule)
[%css "display: block; width: 100%"]
(* ----- *)
[|display(`block), width(percent(100.))|] Cons
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I keep seeing this pattern, which tries to compose styles:
I was thinking about having a way to do it inside styled-ppx (cx/styled.) like the following:
Interpolation right now works on values (and selectors), adding this would make interpolation possible on properties. I'm assuming only one property but it can be extended to deal with more than one.
The text was updated successfully, but these errors were encountered: