mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
Fix <Icon type="cross" /> compatibility, #12970
This commit is contained in:
parent
4c5e3492ac
commit
488f5a101d
@ -93,6 +93,7 @@ const icons = [
|
||||
'exclamation-circle-o',
|
||||
'exclamation-circle',
|
||||
'close',
|
||||
'cross',
|
||||
'close-circle',
|
||||
'close-circle-o',
|
||||
'close-square',
|
||||
|
@ -6,6 +6,7 @@ import createFromIconfontCN from './IconFont';
|
||||
import {
|
||||
svgBaseProps, withThemeSuffix,
|
||||
removeTypeTheme, getThemeFromTypeName,
|
||||
alias,
|
||||
} from './utils';
|
||||
import warning from '../_util/warning';
|
||||
import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
|
||||
@ -135,7 +136,7 @@ const Icon: IconComponent<IconProps> = (props) => {
|
||||
` the 'theme' prop '${theme}' will be ignored.`);
|
||||
}
|
||||
computedType = withThemeSuffix(
|
||||
removeTypeTheme(type),
|
||||
removeTypeTheme(alias(type)),
|
||||
dangerousTheme || theme || defaultTheme,
|
||||
);
|
||||
innerNode = (
|
||||
|
@ -47,3 +47,13 @@ export function withThemeSuffix(type: string, theme: ThemeType) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// For alias or compatibility
|
||||
export function alias(type: string) {
|
||||
switch (type) {
|
||||
case 'cross':
|
||||
return 'close';
|
||||
default:
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user