astroturf icon indicating copy to clipboard operation
astroturf copied to clipboard

Update README for greater consistency with styled API

Open andriibieriezhnoi opened this issue 6 years ago • 8 comments

I think it would be more convenient for users who switch from styled-components

Reference #33

andriibieriezhnoi avatar Jan 03 '19 18:01 andriibieriezhnoi

Also it is a little shorter

ai avatar Jan 03 '19 18:01 ai

wait this works? @jquense why don't we use this then

taion avatar Jan 03 '19 19:01 taion

@taion yeap, @jquense added this syntax to fix my old issue https://github.com/4Catalyzer/astroturf/issues/33

ai avatar Jan 03 '19 20:01 ai

I think it's less good of a syntax personally, with styled() you use the same function call for dom elements or custom components, it's also a bit less error prone.

Happy to show it in the readme but I think we should prefer the function generally

jquense avatar Jan 03 '19 21:01 jquense

@jquense yeap, we can do it in a different way. We just need to explain for styled components users that they do not need to change the syntax. Do you have an idea how to do it?

ai avatar Jan 03 '19 21:01 ai

@jquense I think astroturf should attract styled/emotion users and README will show them that migrating is not so difficult. This is why I think it is important for us to use SC syntax.

andriibieriezhnoi avatar Jan 03 '19 21:01 andriibieriezhnoi

for sure we should show it and illustrate a migration path, I just don't think we should do so at the expense of now using the other syntax at all.

Can we add a section that shows both? and/or some copy for folks coming from SC or emotion?

jquense avatar Jan 03 '19 21:01 jquense

Maybe it is a good time to write a special section for Migration from SC. We can cover there:

  1. Syntax difference. Show what is supported.
  2. Show workaround for keyframes and injectGlobal.
  3. Explain how to set constants (use postcss-custom-properties or postcss-env-function).
  4. How to have dynamic parts in styles (Custom Properties).

ai avatar Jan 03 '19 21:01 ai