mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
972840e74d
* feat: empty support imageSize prop * docs: update demo for empty component * docs: update docs for empty component * test: update snapshot of empty component demo * feat: empty component support use simple image * docs: update demo for component empty * docs: update doc for empyt component * docs: add absence of a space for demo of empty component
30 lines
789 B
TypeScript
30 lines
789 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="simple" className={`${prefix}-normal`} />;
|
|
|
|
case 'Select':
|
|
case 'TreeSelect':
|
|
case 'Cascader':
|
|
case 'Transfer':
|
|
return <Empty image="simple" className={`${prefix}-small`} />;
|
|
default:
|
|
return <Empty />;
|
|
}
|
|
}}
|
|
</ConfigConsumer>
|
|
);
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
export default renderEmpty;
|