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

css.resolve :global selectors error ts-styled-plugin #717

Open
Adam-Collier opened this issue Jun 13, 2021 · 0 comments
Open

css.resolve :global selectors error ts-styled-plugin #717

Adam-Collier opened this issue Jun 13, 2021 · 0 comments

Comments

@Adam-Collier
Copy link

Hi guys,

I have the below in VS code:

import css from 'styled-jsx/css';
import Row from '../Row';

const getStackStyles = ({ direction, justify, align, gap }) => css.resolve`
  .stack {
    display: flex;
    flex-direction: ${direction};
    justify-content: ${justify};
    align-items: ${align};
  }

  .stack :global(> *) {
    margin-top: 0;
    margin-bottom: 0;
  }

  .row :global(> * + *) {
    margin-left: calc(${gap} * 1rem);
  }

  .column :global(> * + *) {
    margin-top: calc(${gap} * 1rem);
  }

  .page {
    padding-top: 68px;
  }

  @media (max-width: 767px) {
    .row :global(> * + *) {
      margin-left: calc(${gap} * 0.75rem);
    }

    .column :global(> * + *) {
      margin-top: calc(${gap} * 0.75rem);
    }
  }
`;

The problem is even though everything is valid vs code gives us some red squiggles:
image

with the error:
image

Now after playing around it looks like this is down to the :global() selectors being used in the template literal. Any idea how this can be fixed?

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