jxnblk / tachyons-components

React UI components powered by Tachyons with a styled-components like API
MIT License
411 stars 15 forks source link

Add support for multiple classes in computed properties #9

Closed pkanal closed 6 years ago

pkanal commented 6 years ago

The Issue

Adding multiple tachyons classes like this:

export const Link = styled('a')`
  blue
  f6
  no-underline
  ${props => props.nav ? 'fw4 mb2' : ''}
`

The output would be comma separated in the render

<a class="blue f6 no-underline fw4,mb2">My Link</a>

The Solution

This was happening because we have to split each function token which results in nested array. So the solution is to flatten the nested arrays and it works.

Let me know if I should open a corresponding issue before this will be considered! Thanks!

jxnblk commented 6 years ago

Thanks! I don't use this module personally, so hadn't thought of this use-case

jxnblk commented 6 years ago

Looks great, thanks!