naomi icon indicating copy to clipboard operation
naomi copied to clipboard

Multiple referenced styled-components selectors break highlighting for the rest of the file

Open bostrom opened this issue 6 years ago • 2 comments

Referencing multiple child styled-components on the same row breaks syntax highlighting for the rest of the file.

image

Example:

const StyledSection = styled.div`
  background-color: ${({ theme }) => theme.colors.primary};
  text-align: center;
  ${P}, ${H2}, ${H3} {
    color: ${({ theme }) => theme.colors.white};
  }
`;
const HeaderIcon = styled.div`
  display: block;
  align-items: center;
  ${H3} {
    @media (min-width: ${({ theme }) => theme.breakpoints.tablet}) {
      font-size: 1.1rem;
    }
    @media (min-width: ${({ theme }) => theme.breakpoints.desktop}) {
      font-size: 1.5rem;
    }
    font-size: 1.6875rem;
    margin: 0;
  }
`;

bostrom avatar Oct 15 '19 12:10 bostrom

Apparently the same applies for using +.

const StyledP = styled.p`
  text-align: center;
  + ${P} {
    color: ${({ theme }) => theme.colors.white};
  }
`;

bostrom avatar Oct 17 '19 13:10 bostrom

Related issue with styled components and specific nesting issues:

Screen Shot 2019-11-15 at 10 32 37 am

Screen Shot 2019-11-15 at 10 32 47 am

joshuapaling avatar Nov 14 '19 23:11 joshuapaling