New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Icon) Icon with theme and colorful icon #11971
feat(Icon) Icon with theme and colorful icon #11971
Conversation
Deploy preview for ant-design ready! Built with commit 82746c0 |
|
Codecov Report
@@ Coverage Diff @@
## feature-3.9.0 #11971 +/- ##
=================================================
+ Coverage 92.34% 92.36% +0.02%
=================================================
Files 207 208 +1
Lines 5405 5446 +41
Branches 1517 1526 +9
=================================================
+ Hits 4991 5030 +39
- Misses 410 412 +2
Partials 4 4
Continue to review full report at Codecov.
|
说错了,应该是 |
}; | ||
} | ||
render() { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是两个空格的缩进。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不对,这是 ts 生成的文件,那不应该提交上来。
@@ -0,0 +1,23 @@ | |||
/* eslint-disable */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个很不好哦。
return null; | ||
} | ||
} | ||
IconDisplay.displayName = 'IconDisplay'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没必要写 displayName。
@@ -20,7 +20,7 @@ const CopyableIcon: React.SFC<CopyableIconProps> = ({ | |||
onCopy={() => onCopied(type)} | |||
> | |||
<li className={justCopied === type ? 'copied' : ''}> | |||
<Icon type={type} theme={theme} /> | |||
<Icon type={type} theme={theme} primaryColor="#333" secondaryColor="#e6e6e6" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secondaryColor 应该是直接用 primaryColor 算出来的吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primaryColor 应该是只给 twoTone 用的,不如就叫 twoToneColor,和 setTwoToneColors 保持一致。
setTwoToneColors
也改为 setTwoToneColor('xxx')
好了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认的主色是 #333, 副色是 #e6e6e6
用ant-design-palettes无法生成正确的副色
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样
const colors = {
primary: '#333',
secondary: '#E6E6E6', // optional
};
<Icon type={type} theme={theme} twoToneColors={colors} />
如何
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
保留副色的接口是因为 ant-design-palettes
的 generate
函数生成的副色有时无法使用,如
generate('#333')
生成的十个颜色都太深了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#333 到 #e6e6e6 是怎么算出来的呢,不要用 ant-design-palettes,单独写一个转换。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要让用户去设他们能力范围之外的属性。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认主色应该是 antd 的主色。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TwoTone 的 默认效果应该类似 https://ego-icons.com/
svgClassName 和 svgStyle 貌似没啥必要,建议去掉。 |
文档补充一段提示吧,3.9.0 之后新增了哪些 API,这样开发者如果用老版本不容易搞错。 |
|
components/icon/index.zh-CN.md
Outdated
@@ -89,8 +89,9 @@ ReactDOM.render( | |||
| className | 计算后的 `svg` 类名 | string | - | | |||
| style | 计算后的 `svg` 元素样式 | CSSProperties | - | | |||
|
|||
#### 使用 iconfont.cn 的自定义图标 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用三个 ###
上面的 ### Icon 可以去掉,没啥用。
冲突了又,解决了先合并吧。 |
0027e98
to
4ea3aae
Compare
@@ -320,6 +320,7 @@ class RangePicker extends React.Component<any, RangePickerState> { | |||
type="close-circle" | |||
className={`${prefixCls}-picker-clear`} | |||
onClick={this.clearSelection} | |||
theme={'filled'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme="filled"
f44b078
to
e784ac3
Compare
Features
theme
to<Icon />
. It can specific the theme of icons.Bug fixes
c1f63a1
The components
notification
,message
,progress
: status error useclose(-circle)
icon instead ofcross(-circle)
icon.WIP