Skip to content

Commit

Permalink
fix(alert): 修复Alert有description没有icon时样式异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanaMaid committed Jun 24, 2018
1 parent c5b4175 commit 949b32f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
14 changes: 8 additions & 6 deletions components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ export class Alert extends Component<IAlertProps, IAlertState> {
<span style={{display: showIcon ? 'inline-block' : 'none'}} className={`${preCls}-icon`}>
{icon ? icon : (<Icon type={defaultIcon[type]}/>)}
</span>
<p className={`${preCls}-message`}>{title}</p>
{
this.props.children ? (
<p className={`${preCls}-description`}>{this.props.children}</p>
) : null
}
<div className={showIcon && this.props.children ? `${preCls}-has-icon-description` : ''}>
<p className={`${preCls}-message`}>{title}</p>
{
this.props.children ? (
<p className={`${preCls}-description`}>{this.props.children}</p>
) : null
}
</div>
{
closable ? (
<span className={`${preCls}-close`} onClick={this.closeAlert}>
Expand Down
9 changes: 7 additions & 2 deletions components/Alert/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@


&-with-description {
padding: 16px 16px 16px 60px;
padding: 16px;

.@{alert-prefix-cls}-icon {
position: absolute;
Expand All @@ -72,11 +72,16 @@
}

.@{alert-prefix-cls}-close {
font-size: 20px;
font-size: 14px;
right: 8px;
}
}

&-has-icon-description {
display: inline-block;
padding-left: 46px;
}

&-message {
color: rgba(0,0,0,.85);
}
Expand Down

0 comments on commit 949b32f

Please sign in to comment.