Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增Empty组件 #505

Merged
merged 10 commits into from
Sep 18, 2024
11 changes: 4 additions & 7 deletions src/empty/Empty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import TImage from '../image';
import { TdEmptyProps } from './type';
import { StyledProps } from '../common';
import { parseContentTNode } from '../_util/parseTNode';
import parseTNode from '../_util/parseTNode';
import { usePrefixClass } from '../hooks/useClass';

export interface EmptyProps extends TdEmptyProps, StyledProps {}
Expand All @@ -13,15 +13,12 @@ const Empty: React.FC<EmptyProps> = (props) => {
const emptyClass = usePrefixClass('empty');

const renderThumb = () => {
const tNodeImage = parseContentTNode(image, {});
const tNodeImage = parseTNode(image, {});
epoll-j marked this conversation as resolved.
Show resolved Hide resolved
if (tNodeImage) {
if (typeof image === 'string') {
return typeof tNodeImage === 'string' && <TImage src={image} />;
}
return tNodeImage;
return typeof image === 'string' ? <TImage src={image} /> : tNodeImage;
}

const tNodeIcon = parseContentTNode(icon, {});
const tNodeIcon = parseTNode(icon, {});
if (tNodeIcon) {
return <div className={`${emptyClass}__icon`}>{tNodeIcon}</div>;
}
Expand Down
Loading