1
如何翻译涉及兄弟姐妹选择器的规则与styled-components? (我认为它也通过生成的类名涉及造型的其他口味)兄弟姐妹CSS规则与React样式组件/ CSS模块/ CSS-in-JS
const Pane = styled.div`
& > .subItem + .subItem {
margin-top:10px;
}
`
如何翻译涉及兄弟姐妹选择器的规则与styled-components? (我认为它也通过生成的类名涉及造型的其他口味)兄弟姐妹CSS规则与React样式组件/ CSS模块/ CSS-in-JS
const Pane = styled.div`
& > .subItem + .subItem {
margin-top:10px;
}
`
您发布的代码,如果你有对儿童和/或兄弟姐妹静态类的名字完全适用!
我们目前不支持用他们生成的类名选择其他样式的组件,但我们很快就会支持! (可能本周末或下周)
这就是我们要找对加入API:
const StyledDiv = styled.div``
// All StyledDiv's directly inside a Pane will have blue text
const Pane = styled.div`
& > ${StyledDiv} {
color: blue;
}
`
关注this issue和链接的PR,当它的土地被通知。
也许通过添加静态classNames除了生成的? – sylvain
是的 - 我们将有每个组件的静态类(PR:https://github.com/styled-components/styled-components/pull/227),当你插入一个组件时,我们会把这个类放进去它进入CSS – mxstbr