2018-12-26 16:01:00 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
import Empty from '../empty';
|
2019-03-18 12:01:38 +08:00
|
|
|
import { ConfigConsumer, ConfigConsumerProps } from '.';
|
2018-12-26 16:01:00 +08:00
|
|
|
|
|
|
|
const renderEmpty = (componentName?: string): React.ReactNode => (
|
|
|
|
<ConfigConsumer>
|
|
|
|
{({ getPrefixCls }: ConfigConsumerProps) => {
|
|
|
|
const prefix = getPrefixCls('empty');
|
|
|
|
|
|
|
|
switch (componentName) {
|
|
|
|
case 'Table':
|
|
|
|
case 'List':
|
2019-03-20 17:45:35 +08:00
|
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-normal`} />;
|
2018-12-26 16:01:00 +08:00
|
|
|
|
|
|
|
case 'Select':
|
|
|
|
case 'TreeSelect':
|
|
|
|
case 'Cascader':
|
|
|
|
case 'Transfer':
|
2019-03-20 17:45:35 +08:00
|
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
2018-12-26 16:01:00 +08:00
|
|
|
default:
|
|
|
|
return <Empty />;
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
</ConfigConsumer>
|
|
|
|
);
|
|
|
|
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
|
|
|
|
export default renderEmpty;
|