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

Guards Not Working With Strings #63

Open
daniel-nagy opened this issue Jan 13, 2020 · 2 comments
Open

Guards Not Working With Strings #63

daniel-nagy opened this issue Jan 13, 2020 · 2 comments

Comments

@daniel-nagy
Copy link

& when (@variant = "secondary") {
  background-color: @btnSecondaryBgColor;
  border-color: @btnSecondaryBorderColor;
  color: @btnSecondaryColor;
}

This guard is always entered, even when props.variant is not equal to secondary.

@jean343
Copy link
Owner

jean343 commented Jan 13, 2020

Thanks for reporting this issue, I believe we have limited support for guards.
Could you add the complete example with the React component and I will try it.

Thanks,

@jean343
Copy link
Owner

jean343 commented Jan 13, 2020

A workaround is to use the styled syntax

${props => props.variant === "secondary" && css`
  background-color: @btnSecondaryBgColor;
  border-color: @btnSecondaryBorderColor;
  color: @btnSecondaryColor;
`}

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

2 participants