mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
feat(Empty): description prop support undefined/null value to remove description node
This commit is contained in:
parent
dbc8d4b83b
commit
5df766fb5b
@ -9,7 +9,7 @@ describe('Empty', () => {
|
||||
});
|
||||
|
||||
it('description can be false', () => {
|
||||
const wrapper = mount(<Empty description={false} />);
|
||||
const wrapper = mount(<Empty description={undefined} />);
|
||||
expect(wrapper.find('.ant-empty-description').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
@ -16,5 +16,5 @@ Simplest Usage with no description.
|
||||
```jsx
|
||||
import { Empty } from 'antd';
|
||||
|
||||
ReactDOM.render(<Empty description={false} />, mountNode);
|
||||
ReactDOM.render(<Empty description={undefined} />, mountNode);
|
||||
```
|
||||
|
@ -22,7 +22,7 @@ Empty state placeholder.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| description | Customize description | string \| ReactNode \| boolean | - | 3.12.0 |
|
||||
| description | Customize description | string \| ReactNode | - | 3.12.0 |
|
||||
| imageStyle | style of image | CSSProperties | - | 3.16.0 |
|
||||
| image | Customize image. Will tread as image url when string provided. | string \| ReactNode | `Empty.PRESENTED_IMAGE_DEFAULT` | 3.12.0 |
|
||||
|
||||
|
@ -18,7 +18,7 @@ export interface EmptyProps {
|
||||
*/
|
||||
imageStyle?: React.CSSProperties;
|
||||
image?: React.ReactNode;
|
||||
description?: React.ReactNode | boolean;
|
||||
description?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ const OriginEmpty: React.SFC<EmptyProps> = (props: EmptyProps) => (
|
||||
<LocaleReceiver componentName="Empty">
|
||||
{(locale: TransferLocale) => {
|
||||
const prefixCls = getPrefixCls('empty', customizePrefixCls);
|
||||
const des = typeof description === 'boolean' ? description : (description || locale.description);
|
||||
const des = description == null ? description : (description || locale.description);
|
||||
const alt = typeof des === 'string' ? des : 'empty';
|
||||
|
||||
let imageNode: React.ReactNode = null;
|
||||
|
@ -23,7 +23,7 @@ cols: 1
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| description | 自定义描述内容 | string \| ReactNode \| boolean | - | 3.12.0 |
|
||||
| description | 自定义描述内容 | string \| ReactNode | - | 3.12.0 |
|
||||
| imageStyle | 图片样式 | CSSProperties | - | 3.16.0 |
|
||||
| image | 设置显示图片,为 string 时表示自定义图片地址。 | string \| ReactNode | `Empty.PRESENTED_IMAGE_DEFAULT` | 3.12.0 |
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user