-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Formatting styled component for nth-child() is wrong #5961
Copy link
Copy link
Closed
Labels
lang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:testsIssues about tests that are not correct, should be added, or similarIssues about tests that are not correct, should be added, or similar
Description
Input:
const Steps = styled.div`
@media (min-width: ${breakpoints.lg}) {
${Step} {
margin-bottom: 90px;
}
${Step}:nth-child(odd) {
${StepItemDescription} {
grid-row: 1;
grid-column: 3 / span 3;
}
${Image} {
grid-row: 1;
grid-column: 7 / span 6;
}
}
${Step}:nth-child(even) {
${Image} {
grid-row: 1;
grid-column: 3 / span 6;
}
${StepItemDescription} {
grid-row: 1;
grid-column: 10 / span 3;
}
}
}
`;Output:
const Steps = styled.div`
@media (min-width: ${breakpoints.lg}) {
${Step} {
margin-bottom: 90px;
}
${Step}:nth-child (odd) {
${StepItemDescription} {
grid-row: 1;
grid-column: 3 / span 3;
}
${Image} {
grid-row: 1;
grid-column: 7 / span 6;
}
}
${Step}:nth-child (even) {
${Image} {
grid-row: 1;
grid-column: 3 / span 6;
}
${StepItemDescription} {
grid-row: 1;
grid-column: 10 / span 3;
}
}
}
`;Expected behavior:
Notice the space added between the nth-child (odd), this would not make the nth-child selector work. I am not sure how I can use prettier but still make this work.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:testsIssues about tests that are not correct, should be added, or similarIssues about tests that are not correct, should be added, or similar