import * as React from 'react'; import classNames from 'classnames'; import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import emptyImg from './empty.svg'; export interface TransferLocale { description: string; } export interface EmptyProps { prefixCls?: string; className?: string; style?: React.CSSProperties; image?: string; description?: React.ReactNode; children?: React.ReactNode; } const Empty: React.SFC = (props: EmptyProps) => ( {({ getPrefixCls }: ConfigConsumerProps) => { const { className, image, description, children, ...restProps } = props; const prefixCls = getPrefixCls('empty', props.prefixCls); return ( {(locale: TransferLocale) => { const des = description || locale.description; const alt = typeof des === 'string' ? des : 'empty'; let imageNode: React.ReactNode = null; if (!image) { imageNode = {alt}; } else if (typeof image === 'string') { imageNode = {alt}; } else { imageNode = image; } return (
{imageNode}

{des}

{children &&
{children}
}
); }}
); }}
); export default Empty;