Using the sibling selector together with props #2402
-
Yesterday, I ran into the following issue:
As long as two siblings have the same type, this works fine. But if type |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The usual answer is - don't do this. Don't introduce such contextual styles. However, if you really want this you can do this (when using our Babel plugin): const Banner = Styled.div`
${({ type }) => css`
${getColorsForType(type)}
width: 100%;
display: inline-block;
${() => Banner} + ${() => Banner} {
margin-left: 16px;
}
`}
` |
Beta Was this translation helpful? Give feedback.
The usual answer is - don't do this. Don't introduce such contextual styles.
However, if you really want this you can do this (when using our Babel plugin):