admin管理员组文章数量:1315362
How to you translate rules involving siblings selectors with styled-ponents ? (I think it also concerns other flavors of styling through generated class names)
const Pane = styled.div`
& > .subItem + .subItem {
margin-top:10px;
}
`
How to you translate rules involving siblings selectors with styled-ponents ? (I think it also concerns other flavors of styling through generated class names)
const Pane = styled.div`
& > .subItem + .subItem {
margin-top:10px;
}
`
Share
Improve this question
edited Nov 30, 2016 at 7:50
mxstbr
11.5k4 gold badges41 silver badges38 bronze badges
asked Nov 26, 2016 at 20:18
sylvainsylvain
1,9812 gold badges20 silver badges34 bronze badges
1 Answer
Reset to default 8The code you posted totally works if you have static class names on children and/or siblings!
We don't currently support selecting other styled ponents with their generated class names, but we will very very soon! (probably this week or next week)
This is the API we're looking towards adding:
const StyledDiv = styled.div``
// All StyledDiv's directly inside a Pane will have blue text
const Pane = styled.div`
& > ${StyledDiv} {
color: blue;
}
`
Follow this issue and the linked PR to be notified when it lands.
本文标签: javascriptsiblings CSS rules with React styledcomponentsCSS modulesCSSinJSStack Overflow
版权声明:本文标题:javascript - siblings CSS rules with React styled-componentsCSS modulesCSS-in-JS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741974570a2408044.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论