style(Empty): 💄 create simple style Empty in a default way

This commit is contained in:
afc163 2019-04-03 18:59:02 +08:00
parent e1a1cdaa4d
commit 5ee4efb2db
No known key found for this signature in database
GPG Key ID: 738F973FCE5C6B48
7 changed files with 17 additions and 8 deletions

View File

@ -10,7 +10,7 @@ const renderEmpty = (componentName?: string): React.ReactNode => (
switch (componentName) {
case 'Table':
case 'List':
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-normal`} />;
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
case 'Select':
case 'TreeSelect':

View File

@ -20,7 +20,7 @@ ReactDOM.render(
<Empty
image="https://gw.alipayobjects.com/mdn/miniapp_social/afts/img/A*pevERLJC9v0AAAAAAAAAAABjAQAAAQ/original"
imageStyle={{
height: 200,
height: 60,
}}
description={
<span>

View File

@ -17,7 +17,7 @@ You can choose another style of `image` by setting image to `Empty.PRESENTED_IMA
import { Empty } from 'antd';
ReactDOM.render(
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} imageStyle={{ height:40 }} />,
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />,
mountNode
);
```

View File

@ -51,13 +51,20 @@ const OriginEmpty: React.SFC<EmptyProps> = (props: EmptyProps) => (
}
return (
<div className={classNames(prefixCls, className)} {...restProps}>
<div
className={classNames(
prefixCls,
{
[`${prefixCls}-normal`]: image === simpleEmptyImg,
},
className,
)}
{...restProps}
>
<div className={`${prefixCls}-image`} style={imageStyle}>
{imageNode}
</div>
<p className={`${prefixCls}-description`}>{des}</p>
{children && <div className={`${prefixCls}-footer`}>{children}</div>}
</div>
);

View File

@ -29,6 +29,7 @@
// antd internal empty style
&-small {
margin: 8px 0;
color: @disabled-color;
.@{empty-prefix-cls}-image {
height: 35px;
@ -37,6 +38,7 @@
&-normal {
margin: 32px 0;
color: @disabled-color;
.@{empty-prefix-cls}-image {
height: 40px;

View File

@ -32,7 +32,7 @@
&-empty-text {
padding: @list-empty-text-padding;
color: @text-color-secondary;
color: @disabled-color;
font-size: @font-size-base;
text-align: center;
}

View File

@ -408,7 +408,7 @@
position: relative;
z-index: 1;
padding: @table-padding-vertical @table-padding-horizontal;
color: @text-color-secondary;
color: @disabled-color;
font-size: @font-size-base;
text-align: center;
background: @component-background;