diff --git a/components/icon/__tests__/index.test.js b/components/icon/__tests__/index.test.js index 8623475b1e..fd061260fb 100644 --- a/components/icon/__tests__/index.test.js +++ b/components/icon/__tests__/index.test.js @@ -12,7 +12,7 @@ describe('Icon', () => { it('should support two-tone icon', () => { const wrapper = render( - + ); expect(wrapper).toMatchSnapshot(); }); diff --git a/components/icon/demo/basic.md b/components/icon/demo/basic.md index 7a3abbcc98..285b0fd385 100644 --- a/components/icon/demo/basic.md +++ b/components/icon/demo/basic.md @@ -19,8 +19,8 @@ import { Icon } from 'antd'; ReactDOM.render(
- - + +
, diff --git a/components/icon/demo/two-tone.md b/components/icon/demo/two-tone.md index 14fb2f3b9f..b865773fc0 100644 --- a/components/icon/demo/two-tone.md +++ b/components/icon/demo/two-tone.md @@ -7,11 +7,11 @@ title: ## zh-CN -可以通过设置 `theme` 属性为 `twotone` 来渲染双色图标,并且可以设置全局性的主题色。 +可以通过设置 `theme` 属性为 `two-tone` 来渲染双色图标,并且可以设置全局性的主题色。 ## en-US -Specific them property `theme` to `twotone` to render two-tone icons. You can also set the primary color globally. +Specific them property `theme` to `two-tone` to render two-tone icons. You can also set the primary color globally. ````jsx import { Icon } from 'antd'; @@ -20,9 +20,9 @@ Icon.setTwoTonePrimaryColor('#1890ff'); ReactDOM.render(
- - - + + +
, mountNode ); diff --git a/components/icon/index.en-US.md b/components/icon/index.en-US.md index 3ad183a910..fec3d05a5c 100644 --- a/components/icon/index.en-US.md +++ b/components/icon/index.en-US.md @@ -59,7 +59,7 @@ ReactDOM.render(, mountNode); | --- | --- | --- | --- | | type | Type of the ant design icon | string | - | | style | Style properties of icon, like `fontSize` and `color` | CSSProperties | - | -| theme | Theme of the ant design icon | 'fill' \| 'outline' \| 'twotone' | - | +| theme | Theme of the ant design icon | 'filled' \| 'outlined' \| 'two-tone' | - | | svgStyle | Inline style to apply to the SVG element | CSSProperties | - | | svgClassName | Define extra class name for the SVG element | string | - | | spin | Rotate icon with animation | boolean | false | diff --git a/components/icon/index.tsx b/components/icon/index.tsx index 8126e00ed1..d04d32e806 100755 --- a/components/icon/index.tsx +++ b/components/icon/index.tsx @@ -19,7 +19,7 @@ export interface CustomIconComponentProps { ['aria-hidden']?: string; } -export type ThemeType = 'fill' | 'outline' | 'twotone'; +export type ThemeType = 'filled' | 'outlined' | 'two-tone'; export interface IconProps { type?: string; diff --git a/components/icon/index.zh-CN.md b/components/icon/index.zh-CN.md index 56ef105cfa..91bc77970a 100644 --- a/components/icon/index.zh-CN.md +++ b/components/icon/index.zh-CN.md @@ -63,7 +63,7 @@ ReactDOM.render(, mountNode); | --- | --- | --- | --- | | type | 图标类型。遵循图标的命名规范 | string | - | | style | 设置图标的样式,例如 `fontSize` 和 `color` | CSSProperties | - | -| theme | 图标主题风格。可选实心、描线、双色等主题风格,适用于官方图标 | 'fill' \| 'outline' \| 'twotone' | - | +| theme | 图标主题风格。可选实心、描线、双色等主题风格,适用于官方图标 | 'filled' \| 'outlined' \| 'two-tone' | - | | svgStyle | 设置图标本身``标签的样式 | CSSProperties | - | | svgClassName | 为图标本身``标签设置额外的类名 | string | - | | spin | 是否有旋转动画 | boolean | false | diff --git a/components/icon/utils.ts b/components/icon/utils.ts index 3d951628cc..ad5fd864ca 100644 --- a/components/icon/utils.ts +++ b/components/icon/utils.ts @@ -17,11 +17,11 @@ const twoToneTester = /-twotone$/; export function getThemeFromTypeName(type: string): ThemeType | null { let result: ThemeType | null = null; if (fillTester.test(type)) { - result = 'fill'; + result = 'filled'; } else if (outlineTester.test(type)) { - result = 'outline'; + result = 'outlined'; } else if (twoToneTester.test(type)) { - result = 'twotone'; + result = 'two-tone'; } return result; } @@ -33,11 +33,11 @@ export function withThemeSuffix(type: string, theme: ThemeType) { ` The prop 'theme' will be ignored.`); let result = type; if (!alreadyHaveTheme) { - if (theme === 'fill') { + if (theme === 'filled') { result += '-fill'; - } else if (theme === 'outline') { + } else if (theme === 'outlined') { result += '-o'; - } else if (theme === 'twotone') { + } else if (theme === 'two-tone') { result += '-twotone'; } else { warning(false, `This icon '${type}' has unknown theme '${theme}'`);