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 ( return (
<div className={classNames({ [`${prefixCls}-with-icon`]: iconNode })} role={role}> <div
className={classNames({
[`${prefixCls}-with-icon`]: iconNode,
[`${prefixCls}-${type}-bg`]: !!type,
})}
role={role}
>
{iconNode} {iconNode}
<div className={`${prefixCls}-message`}>{message}</div> <div className={`${prefixCls}-message`}>{message}</div>
<div className={`${prefixCls}-description`}>{description}</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" class="ant-notification-notice-content"
> >
<div <div
class="ant-notification-notice-with-icon" class="ant-notification-notice-with-icon ant-notification-notice-success-bg"
role="alert" role="alert"
> >
<span <span

View File

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

View File

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