Skip to content

Commit

Permalink
fix(Modal): fix confirm icon style when using third-party icons
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Apr 16, 2024
1 parent 717272d commit 0278c79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/modal/ConfirmDialog.tsx
Expand Up @@ -142,7 +142,7 @@ export function ConfirmContent(
[`${bodyCls}-has-title`]: hasTitle,
})}
>
{mergedIcon}
<div className={`${confirmPrefixCls}-icon`}>{mergedIcon}</div>
<div className={`${confirmPrefixCls}-paragraph`}>
{hasTitle && <span className={`${confirmPrefixCls}-title`}>{props.title}</span>}
<div className={`${confirmPrefixCls}-content`}>{props.content}</div>
Expand Down
22 changes: 12 additions & 10 deletions components/modal/style/confirm.ts
Expand Up @@ -44,7 +44,8 @@ const genModalConfirmStyle: GenerateStyle<ModalToken> = (token) => {
flexWrap: 'nowrap',
alignItems: 'start',

[`> ${token.iconCls}`]: {
[`> ${confirmComponentCls}-icon`]: {
display: 'flex',
flex: 'none',
fontSize: modalConfirmIconSize,
marginInlineEnd: token.confirmIconMarginInlineEnd,
Expand All @@ -53,7 +54,7 @@ const genModalConfirmStyle: GenerateStyle<ModalToken> = (token) => {
.div(2)
.equal(),
},
[`&-has-title > ${token.iconCls}`]: {
[`&-has-title > ${confirmComponentCls}-icon`]: {
marginTop: token
.calc(token.calc(modalTitleHeight).sub(modalConfirmIconSize).equal())
.div(2)
Expand All @@ -69,7 +70,7 @@ const genModalConfirmStyle: GenerateStyle<ModalToken> = (token) => {
},

// https://github.com/ant-design/ant-design/issues/48159
[`${token.iconCls} + ${confirmComponentCls}-paragraph`]: {
[`${confirmComponentCls}-icon + ${confirmComponentCls}-paragraph`]: {
maxWidth: `calc(100% - ${unit(
token.calc(token.modalConfirmIconSize).add(token.marginSM).equal(),
)})`,
Expand Down Expand Up @@ -100,20 +101,21 @@ const genModalConfirmStyle: GenerateStyle<ModalToken> = (token) => {
},
},

[`${confirmComponentCls}-error ${confirmComponentCls}-body > ${token.iconCls}`]: {
[`${confirmComponentCls}-error ${confirmComponentCls}-body > ${confirmComponentCls}-icon`]: {
color: token.colorError,
},

[`${confirmComponentCls}-warning ${confirmComponentCls}-body > ${token.iconCls},
${confirmComponentCls}-confirm ${confirmComponentCls}-body > ${token.iconCls}`]: {
color: token.colorWarning,
},
[`${confirmComponentCls}-warning ${confirmComponentCls}-body > ${confirmComponentCls}-icon,
${confirmComponentCls}-confirm ${confirmComponentCls}-body > ${confirmComponentCls}-icon`]:
{
color: token.colorWarning,
},

[`${confirmComponentCls}-info ${confirmComponentCls}-body > ${token.iconCls}`]: {
[`${confirmComponentCls}-info ${confirmComponentCls}-body > ${confirmComponentCls}-icon`]: {
color: token.colorInfo,
},

[`${confirmComponentCls}-success ${confirmComponentCls}-body > ${token.iconCls}`]: {
[`${confirmComponentCls}-success ${confirmComponentCls}-body > ${confirmComponentCls}-icon`]: {
color: token.colorSuccess,
},
};
Expand Down

0 comments on commit 0278c79

Please sign in to comment.