Commit 195dc64e authored by 涂茜's avatar 涂茜

fix: update empty

parent dcf8ae65
Pipeline #25717 failed with stages
in 14 seconds
......@@ -2,17 +2,24 @@ import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { ConfigProvider } from 'antd';
import noDataLight from './assets/noDataLight.svg';
import noDataDark from './assets/noDataDark.svg';
import { ReactComponent as noDataLight } from './assets/noDataLight.svg';
import { ReactComponent as noDataDark } from './assets/noDataDark.svg';
import errorLight from './assets/errorLight.png';
import errorDark from './assets/errorDark.png';
import './index.less';
const IconBase = ({ icon: SvgIcon }) => {
const SvgAttributes = {
width: '100%',
height: '100%',
};
return <SvgIcon {...SvgAttributes} />;
};
const Empty = ({ description, image, theme, size, statusCode, imageStyle, children }) => {
const alt = description ? description : 'empty';
const des = description ? description : DESC_DATA[`${statusCode}`];
const imageSrc = image ? image : IMAGE_DATA[theme][statusCode == '0' ? 0 : 1];
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('panda-empty');
......@@ -20,7 +27,12 @@ const Empty = ({ description, image, theme, size, statusCode, imageStyle, childr
let imageNode = null;
if (typeof image === 'string') {
imageNode = <img alt={alt} src={imageSrc} />;
if (statusCode == '0') {
imageNode = <IconBase icon={IMAGE_DATA[theme][0]} />;
} else {
let imageSrc = image ? image : IMAGE_DATA[theme][1];
imageNode = <img alt={alt} src={imageSrc} />;
}
} else {
imageNode = image;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment