mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-18 03:14:07 +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-o',
|
||||||
'exclamation-circle',
|
'exclamation-circle',
|
||||||
'close',
|
'close',
|
||||||
|
'cross',
|
||||||
'close-circle',
|
'close-circle',
|
||||||
'close-circle-o',
|
'close-circle-o',
|
||||||
'close-square',
|
'close-square',
|
||||||
|
@ -6,6 +6,7 @@ import createFromIconfontCN from './IconFont';
|
|||||||
import {
|
import {
|
||||||
svgBaseProps, withThemeSuffix,
|
svgBaseProps, withThemeSuffix,
|
||||||
removeTypeTheme, getThemeFromTypeName,
|
removeTypeTheme, getThemeFromTypeName,
|
||||||
|
alias,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
|
import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
|
||||||
@ -135,7 +136,7 @@ const Icon: IconComponent<IconProps> = (props) => {
|
|||||||
` the 'theme' prop '${theme}' will be ignored.`);
|
` the 'theme' prop '${theme}' will be ignored.`);
|
||||||
}
|
}
|
||||||
computedType = withThemeSuffix(
|
computedType = withThemeSuffix(
|
||||||
removeTypeTheme(type),
|
removeTypeTheme(alias(type)),
|
||||||
dangerousTheme || theme || defaultTheme,
|
dangerousTheme || theme || defaultTheme,
|
||||||
);
|
);
|
||||||
innerNode = (
|
innerNode = (
|
||||||
|
@ -47,3 +47,13 @@ export function withThemeSuffix(type: string, theme: ThemeType) {
|
|||||||
}
|
}
|
||||||
return result;
|
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