ant-design/components/config-provider/renderEmpty.tsx
DiamondYuan 972840e74d feat: Improve Empty component (#15444)
* 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
2019-03-18 12:01:38 +08:00

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;