mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
1719748a29
* chore: eslint add consistent-type-imports * fix avatar * Update Item.tsx
32 lines
852 B
TypeScript
32 lines
852 B
TypeScript
import * as React from 'react';
|
|
import Empty from '../empty';
|
|
import type { ConfigConsumerProps } from '.';
|
|
import { ConfigConsumer } 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':
|
|
case 'Mentions':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
|
default:
|
|
return <Empty />;
|
|
}
|
|
}}
|
|
</ConfigConsumer>
|
|
);
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
export default renderEmpty;
|