Merge branch 'develop' into 'master'
feat(zhst/meta): 修改ts See merge request web-project/zhst-lambo!57
This commit is contained in:
commit
5c5115471d
@ -1,5 +1,4 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { CheckCircleFilled, CloseCircleFilled, ExclamationCircleFilled, WarningFilled } from '@ant-design/icons'
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { devUseWarning } from '../_util/warning';
|
import { devUseWarning } from '../_util/warning';
|
||||||
@ -9,16 +8,6 @@ import serverError from './serverError';
|
|||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import unauthorized from './unauthorized';
|
import unauthorized from './unauthorized';
|
||||||
|
|
||||||
export const IconMap = {
|
|
||||||
// @ts-ignore
|
|
||||||
success: CheckCircleFilled,
|
|
||||||
// @ts-ignore
|
|
||||||
error: CloseCircleFilled,
|
|
||||||
// @ts-ignore
|
|
||||||
info: ExclamationCircleFilled,
|
|
||||||
// @ts-ignore
|
|
||||||
warning: WarningFilled,
|
|
||||||
};
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const ExceptionMap = {
|
export const ExceptionMap = {
|
||||||
'404': noFound,
|
'404': noFound,
|
||||||
@ -27,7 +16,7 @@ export const ExceptionMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type ExceptionStatusType = 403 | 404 | 500 | '403' | '404' | '500';
|
export type ExceptionStatusType = 403 | 404 | 500 | '403' | '404' | '500';
|
||||||
export type ResultStatusType = ExceptionStatusType | keyof typeof IconMap;
|
export type ResultStatusType = ExceptionStatusType;
|
||||||
|
|
||||||
export interface ResultProps {
|
export interface ResultProps {
|
||||||
icon?: React.ReactNode;
|
icon?: React.ReactNode;
|
||||||
@ -80,15 +69,11 @@ const Icon: React.FC<IconProps> = ({ prefixCls, icon, status }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconNode = React.createElement(
|
|
||||||
IconMap[status as Exclude<ResultStatusType, ExceptionStatusType>],
|
|
||||||
);
|
|
||||||
|
|
||||||
if (icon === null || icon === false) {
|
if (icon === null || icon === false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className={className}>{icon || iconNode}</div>;
|
return <div className={className}>{icon || 'icon'}</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ExtraProps {
|
interface ExtraProps {
|
||||||
|
Loading…
Reference in New Issue
Block a user