This commit is contained in:
ug 2025-06-04 10:52:52 +08:00 committed by GitHub
commit 66f6f2feda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 53 additions and 3 deletions

View File

@ -61,7 +61,13 @@ export const PureContent: React.FC<PureContentProps> = (props) => {
});
}
return (
<div className={classNames({ [`${prefixCls}-with-icon`]: iconNode })} role={role}>
<div
className={classNames({
[`${prefixCls}-with-icon`]: iconNode,
[`${prefixCls}-${type}-bg`]: !!type,
})}
role={role}
>
{iconNode}
<div className={`${prefixCls}-message`}>{message}</div>
<div className={`${prefixCls}-description`}>{description}</div>

View File

@ -459,7 +459,7 @@ exports[`renders components/notification/demo/render-panel.tsx extend context co
class="ant-notification-notice-content"
>
<div
class="ant-notification-notice-with-icon"
class="ant-notification-notice-with-icon ant-notification-notice-success-bg"
role="alert"
>
<span

View File

@ -447,7 +447,7 @@ exports[`renders components/notification/demo/render-panel.tsx correctly 1`] = `
class="ant-notification-notice-content"
>
<div
class="ant-notification-notice-with-icon"
class="ant-notification-notice-with-icon ant-notification-notice-success-bg"
role="alert"
>
<span

View File

@ -20,6 +20,26 @@ export interface ComponentToken {
* @descEN Width of Notification
*/
width: number | string;
/**
* @desc success背景色
* @descEN Background color of Notification success
*/
colorSuccessBgElevated: string;
/**
* @desc error背景色
* @descEN Background color of Notification error
*/
colorErrorBgElevated: string;
/**
* @desc info背景色
* @descEN Background color of Notification info
*/
colorInfoBgElevated: string;
/**
* @desc warning背景色
* @descEN Background color of Notification warning
*/
colorWarningBgElevated: string;
}
/**
@ -111,6 +131,10 @@ export const genNoticeStyle = (token: NotificationToken): CSSObject => {
lineHeight,
width,
notificationIconSize,
colorSuccessBgElevated,
colorErrorBgElevated,
colorInfoBgElevated,
colorWarningBgElevated,
colorText,
} = token;
@ -133,6 +157,22 @@ export const genNoticeStyle = (token: NotificationToken): CSSObject => {
wordWrap: 'break-word',
},
[`${noticeCls}-success-bg`]: {
background: colorSuccessBgElevated,
},
[`${noticeCls}-info-bg`]: {
background: colorInfoBgElevated,
},
[`${noticeCls}-warning-bg`]: {
background: colorWarningBgElevated,
},
[`${noticeCls}-error-bg`]: {
background: colorErrorBgElevated,
},
[`${noticeCls}-message`]: {
marginBottom: token.marginXS,
color: colorTextHeading,
@ -350,6 +390,10 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
export const prepareComponentToken = (token: AliasToken) => ({
zIndexPopup: token.zIndexPopupBase + CONTAINER_MAX_OFFSET + 50,
width: 384,
colorSuccessBgElevated: token.colorBgElevated,
colorErrorBgElevated: token.colorBgElevated,
colorInfoBgElevated: token.colorBgElevated,
colorWarningBgElevated: token.colorBgElevated,
});
export const prepareNotificationToken: (