mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
35 lines
983 B
TypeScript
35 lines
983 B
TypeScript
import * as React from 'react';
|
|
import type { ConfigConsumerProps } from '.';
|
|
import { ConfigConsumer } from '.';
|
|
import Empty from '../empty';
|
|
|
|
const defaultRenderEmpty = (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':
|
|
case 'Mentions':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
|
|
|
/* istanbul ignore next */
|
|
default:
|
|
// Should never hit if we take all the component into consider.
|
|
return <Empty />;
|
|
}
|
|
}}
|
|
</ConfigConsumer>
|
|
);
|
|
|
|
export type RenderEmptyHandler = typeof defaultRenderEmpty;
|
|
|
|
export default defaultRenderEmpty;
|