mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
30 lines
802 B
TypeScript
30 lines
802 B
TypeScript
import * as React from 'react';
|
|
import Empty from '../empty';
|
|
import { ConfigConsumer, ConfigConsumerProps } from '.';
|
|
|
|
const renderEmpty = (componentName?: string): React.ReactNode => (
|
|
<ConfigConsumer>
|
|
{({ getPrefixCls }: ConfigConsumerProps) => {
|
|
const prefix = getPrefixCls('empty');
|
|
|
|
switch (componentName) {
|
|
case 'Table':
|
|
case 'List':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
|
|
case 'Select':
|
|
case 'TreeSelect':
|
|
case 'Cascader':
|
|
case 'Transfer':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
|
default:
|
|
return <Empty />;
|
|
}
|
|
}}
|
|
</ConfigConsumer>
|
|
);
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
export default renderEmpty;
|