mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
ecb2eb6ede
* init * first demo * support empty * add loading support * add form sample * update form sample * omit value & defaultValue * add 2 rest demo * placement support * update docs * fix test * update docs * add test case * fix lint * follow textarea style * update docs style
31 lines
827 B
TypeScript
31 lines
827 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':
|
|
case 'Mentions':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
|
default:
|
|
return <Empty />;
|
|
}
|
|
}}
|
|
</ConfigConsumer>
|
|
);
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
export default renderEmpty;
|