feat(zhst/meta): 修改ts

This commit is contained in:
NICE CODE BY DEV 2024-06-05 15:47:14 +08:00
parent 1ff779c1de
commit 066428c8b6

View File

@ -1,5 +1,4 @@
import * as React from 'react';
import { CheckCircleFilled, CloseCircleFilled, ExclamationCircleFilled, WarningFilled } from '@ant-design/icons'
import classNames from 'classnames';
import { devUseWarning } from '../_util/warning';
@ -9,16 +8,6 @@ import serverError from './serverError';
import useStyle from './style';
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
export const ExceptionMap = {
'404': noFound,
@ -27,7 +16,7 @@ export const ExceptionMap = {
};
export type ExceptionStatusType = 403 | 404 | 500 | '403' | '404' | '500';
export type ResultStatusType = ExceptionStatusType | keyof typeof IconMap;
export type ResultStatusType = ExceptionStatusType;
export interface ResultProps {
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) {
return null;
}
return <div className={className}>{icon || iconNode}</div>;
return <div className={className}>{icon || 'icon'}</div>;
};
interface ExtraProps {