I have a component for example:
const pretty = styled.div`
--nth-child: 5n;
--size: 20px; //css variable
width: var(--size);
&:nth-child(var(--nth-child)) {
//...styles...
}
@media (max-width: 768px) {
//overriding
--size: 12px;
--nth-child: 3n;
}
`
The question is how to interpolate css variable in this place?
&:nth-child(var(--nth-child)) {
//...styles...
}
If I understood correctly this is impossible so it would be nice to find another solution
Note: I can't use JS variables in my case
Update:
Also editor highlights the error there:
so I tried this, but this does not work either:
&:nth-child(${css`var(--nth-child)`}) {
margin-right: 0;
}
