ant-design/components/config-provider/defaultRenderEmpty.tsx
二货机器人 3d21ec54e2
refactor: reduce empty cycling deps (#35570)
* chore: rm in root

* chore: fix ts

* test: Update snapshot

* chore: ignore part
2022-05-16 16:34:42 +08:00

35 lines
983 B
TypeScript

import * as React from 'react';
import Empty from '../empty';
import type { ConfigConsumerProps } from '.';
import { ConfigConsumer } from '.';
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;