Replies: 3 comments
-
深有同感,以前各种class和style实在是太松散了,感觉聚合起来更加方便管理,使用起来也更加方便 |
Beta Was this translation helpful? Give feedback.
0 replies
-
stye -> styles 建议命名对其 |
Beta Was this translation helpful? Give feedback.
0 replies
-
import React from 'react'; export default () => ( |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Define semantic dom structure, .e.g
root
inner
. These conceptions could be used inclasses
styles
or other dom related props to specify which element it would be applied to.Activation
Currently we may provide multiple
-ClassName
or-Style
props for one component, such aspopupClassName
rootClassName
. These props are usually named with element type or usage and would become more in the future. So we prefer to merge theme intoclasses
orstyles
. For example, we could usepopupClassName="custom-popup"
before, and now it should be conterted toclasses={{ popup: 'custom-popup' }}
, which is simpler and more explict.In order to introduce
classes
styles
and other props like this, we need to define semantic dom structure for each component. The structure may be different from each other, so each component in antd would have unique type defination for these props. And each property, such asroot
, would be correspond with one element in the component.API
Tooltip
{ root?: string; inner?: string }
{ root?: string; inner?: string }
Basic Example
Detailed Design
Since components have different dom structure or implementation, we would introduce
classes
andstyles
one by one. If there are already some-ClassName
and-Styles
props, we should merge them intoclasses
andstyles
.Common naming of semantic dom structure would be listed here and in wiki, and would be updated at any time if needed.
*-inner
.More semantic properties could be introduce in the future. Once one is added, all dom-related props should support it.
How we teach this
In feature branch:
classes
andstyles
into components whose structure have been discussed and approved by collaborators.-ClassName
and-Styles
and give warning.Beta Was this translation helpful? Give feedback.
All reactions