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

Using external string variables inside calc() break the operation on built version #803

Open
thomasryu opened this issue Jul 21, 2022 · 0 comments

Comments

@thomasryu
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Using a variable inside a calc() operator removes the whitespaces, causing + and - operations to break.

If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar

styles.ts:

const contentSize = '1140px'

export default css`
  .container {
    padding: 0 calc((100vw - ${contentSize}) / 2);
  }
`  

What is the expected behavior?
The component should style properly, with a lateral padding.
But what happens is, the built CSS removes the whitespaces around the - and break the calc() .

Environment (include versions)
Version of styled-jsx (or next.js if it's being used): next.js 12.0.9
Browser: Google Chrome Version 95.0.4638.69 (Official Build) (64-bit)
OS: Ubuntu 20.04.2 LTS (fossa-kakuna X63)

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