davesnx / styled-ppx

Type-safe styled components for ReScript, Melange and native with type-safe CSS
https://styled-ppx.vercel.app
BSD 2-Clause "Simplified" License
399 stars 32 forks source link

Docs clarification #406

Closed psb closed 7 months ago

psb commented 7 months ago

Minor updates to the docs to fix spelling errors and to add some clarifications. Still some questions:

1) I'm not sure what you are trying to say with this line. I have tried to rephrase it as:

  • Only single properties are allowed; declarations are not allowed. Declarations can contain selectors, but rules can only contain a single pairing of property and value. If you need a selector or more than one rule, use %cx{:rescript} instead.

But I'm not sure if this makes sense as I don't really understand the original line.

2) Is there a missing link on this line? [Css bindings] is in square brackets but I don't know why.

vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
styled-ppx ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2024 7:06pm
davesnx commented 7 months ago
  1. I'm not sure what you are trying to say with this line. I have tried to rephrase it as:
  • Only single properties are allowed; declarations are not allowed. Declarations can contain selectors, but rules can only contain a single pairing of property and value. If you need a selector or more than one rule, use %cx{:rescript} instead.

%css() only works on properties (color: blue) and doesn't work with anything else: :hover { color: blue} or color: blue; background-color: red. It's just one property.

Now reading the text I agree it doesn't give that impression, but unsure how to make it more clear.

  1. Is there a missing link on this line? [Css bindings] is in square brackets but I don't know why.

It's a link that should point to the Css bindings API that ships with styled-ppx, but I haven't had the time to publish the docs for it (I should use odoc for it and somehow make it available under the next site). I would either remove the link or point to ocaml.org when I publish styled-ppx to opam

psb commented 7 months ago
  1. I'm not sure what you are trying to say with this line. I have tried to rephrase it as:
  • Only single properties are allowed; declarations are not allowed. Declarations can contain selectors, but rules can only contain a single pairing of property and value. If you need a selector or more than one rule, use %cx{:rescript} instead.

%css() only works on properties (color: blue) and doesn't work with anything else: :hover { color: blue} or color: blue; background-color: red. It's just one property.

Now reading the text I agree it doesn't give that impression, but unsure how to make it more clear.

I think adding the examples you have written help. So we could change it to something like:

Only single properties are allowed, e.g., color: blue, and multiple declarations, e.g., :hover { color: blue} or color: blue; background-color: red, are not allowed. If you need to use a selector or use more than one rule, use %cx{:rescript} instead.

  1. Is there a missing link on this line? [Css bindings] is in square brackets but I don't know why.

It's a link that should point to the Css bindings API that ships with styled-ppx, but I haven't had the time to publish the docs for it (I should use odoc for it and somehow make it available under the next site). I would either remove the link or point to ocaml.org when I publish styled-ppx to opam

I'll remove the missing link for now.

davesnx commented 7 months ago

Only single properties are allowed, e.g., color: blue, and multiple declarations, e.g., :hover { color: blue} or color: blue; background-color: red, are not allowed. If you need to use a selector or use more than one rule, use %cx{:rescript} instead.

That makes sense