Skip to content
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

The last token in a composition should have the highest priority #42

Open
CodingDive opened this issue Apr 9, 2020 · 1 comment
Open

Comments

@CodingDive
Copy link

In a composition like the following

<p className={compose(
  tokens.color.BLUE_10,
  true && tokens.color.RED_90
)}>
  I believe this text should be red
</p>

I'd expect the red color to be applied instead of the blue one. I'm using version 11.0.7.

A reproduction can be found here but you may need to download it and try it locally as classy-ui doesn't work in a Codesandbox at the moment (tracked in #41).

@CodingDive
Copy link
Author

A way to work around it is to add two compositions but since my styles tend to have a lot of conditional logic, I'd need to create another composition for every variable which could quickly go out of hand.

const defaultParagraph = compose(tokens.color.BLUE_10);
const errorParagraph = compose(defaultParagraph, true && tokens.color.RED_90);

Produces the correct result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant