mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
✨ feat: migrate less to token for Notification (#42079)
* feat: migrate less to token for Notification * feat: migrate less to token for Notification * docs: update docs * docs: update docs * docs: update docs * docs: update docs * docs: update docs
This commit is contained in:
parent
4cf6f1b83b
commit
629087833f
@ -9,18 +9,18 @@ import genNotificationPlacementStyle from './placement';
|
|||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
width: number;
|
width: number;
|
||||||
|
notificationBg: string;
|
||||||
|
notificationPadding: string;
|
||||||
|
notificationPaddingVertical: number;
|
||||||
|
notificationPaddingHorizontal: number;
|
||||||
|
notificationIconSize: number;
|
||||||
|
notificationCloseButtonSize: number;
|
||||||
|
notificationMarginBottom: number;
|
||||||
|
notificationMarginEdge: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotificationToken extends FullToken<'Notification'> {
|
export interface NotificationToken extends FullToken<'Notification'> {
|
||||||
notificationBg: string;
|
|
||||||
notificationPaddingVertical: number;
|
|
||||||
notificationPaddingHorizontal: number;
|
|
||||||
notificationPadding: string;
|
|
||||||
notificationMarginBottom: number;
|
|
||||||
notificationMarginEdge: number;
|
|
||||||
animationMaxHeight: number;
|
animationMaxHeight: number;
|
||||||
notificationIconSize: number;
|
|
||||||
notificationCloseButtonSize: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
|
const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
|
||||||
@ -269,27 +269,27 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
|
|||||||
export default genComponentStyleHook(
|
export default genComponentStyleHook(
|
||||||
'Notification',
|
'Notification',
|
||||||
(token) => {
|
(token) => {
|
||||||
const notificationPaddingVertical = token.paddingMD;
|
|
||||||
const notificationPaddingHorizontal = token.paddingLG;
|
|
||||||
|
|
||||||
const notificationToken = mergeToken<NotificationToken>(token, {
|
const notificationToken = mergeToken<NotificationToken>(token, {
|
||||||
// default.less variables
|
|
||||||
notificationBg: token.colorBgElevated,
|
|
||||||
notificationPaddingVertical,
|
|
||||||
notificationPaddingHorizontal,
|
|
||||||
// index.less variables
|
// index.less variables
|
||||||
notificationPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`,
|
|
||||||
notificationMarginBottom: token.margin,
|
|
||||||
notificationMarginEdge: token.marginLG,
|
|
||||||
animationMaxHeight: 150,
|
animationMaxHeight: 150,
|
||||||
notificationIconSize: token.fontSizeLG * token.lineHeightLG,
|
|
||||||
notificationCloseButtonSize: token.controlHeightLG * 0.55,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return [genNotificationStyle(notificationToken)];
|
return [genNotificationStyle(notificationToken)];
|
||||||
},
|
},
|
||||||
(token) => ({
|
(token) => {
|
||||||
zIndexPopup: token.zIndexPopupBase + 50,
|
const notificationPaddingVertical = token.paddingMD;
|
||||||
width: 384,
|
const notificationPaddingHorizontal = token.paddingLG;
|
||||||
}),
|
return {
|
||||||
|
zIndexPopup: token.zIndexPopupBase + 50,
|
||||||
|
width: 384,
|
||||||
|
notificationBg: token.colorBgElevated,
|
||||||
|
notificationPaddingVertical,
|
||||||
|
notificationPaddingHorizontal,
|
||||||
|
notificationIconSize: token.fontSizeLG * token.lineHeightLG,
|
||||||
|
notificationCloseButtonSize: token.controlHeightLG * 0.55,
|
||||||
|
notificationMarginBottom: token.margin,
|
||||||
|
notificationPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`,
|
||||||
|
notificationMarginEdge: token.marginLG,
|
||||||
|
};
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
@ -91,7 +91,18 @@ This document contains the correspondence between all the less variables related
|
|||||||
| `@modal-confirm-title-font-size` | `modalHeaderTitleFontSize` | - |
|
| `@modal-confirm-title-font-size` | `modalHeaderTitleFontSize` | - |
|
||||||
| `@modal-border-radius` | `borderRadiusLG` | - |
|
| `@modal-border-radius` | `borderRadiusLG` | - |
|
||||||
|
|
||||||
<!-- ### Notification -->
|
## Notification
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
| Less variables | Component Token | Note |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `@notification-width` | `width` | - |
|
||||||
|
| `@notification-padding` | `notificationPadding` | - |
|
||||||
|
| `@notification-padding-vertical` | `notificationPaddingVertical` | - |
|
||||||
|
| `@notification-padding-horizontal` | `notificationPaddingHorizontal` | - |
|
||||||
|
| `@notification-margin-bottom` | `notificationMarginBottom` | - |
|
||||||
|
| `@notification-margin-edge` | `notificationMarginEdge` | - |
|
||||||
|
| `@notification-bg` | `notificationBg` | - |
|
||||||
|
|
||||||
<!-- ### Pagination -->
|
<!-- ### Pagination -->
|
||||||
|
|
||||||
@ -118,7 +129,7 @@ This document contains the correspondence between all the less variables related
|
|||||||
## Step
|
## Step
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
| less 变量 | Component Token | 备注 |
|
| Less variables | Component Token | Note |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `@process-tail-color` | `processTailColor` | - |
|
| `@process-tail-color` | `processTailColor` | - |
|
||||||
| `@steps-nav-arrow-color` | `stepsNavArrowColor` | - |
|
| `@steps-nav-arrow-color` | `stepsNavArrowColor` | - |
|
||||||
|
@ -91,7 +91,18 @@ title: Less 变量迁移 Design Token
|
|||||||
| `@modal-confirm-title-font-size` | `modalHeaderTitleFontSize` | - |
|
| `@modal-confirm-title-font-size` | `modalHeaderTitleFontSize` | - |
|
||||||
| `@modal-border-radius` | `borderRadiusLG` | - |
|
| `@modal-border-radius` | `borderRadiusLG` | - |
|
||||||
|
|
||||||
<!-- ### Notification 通知提醒框 -->
|
## Notification 通知提醒框
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
| Less 变量 | Component Token | 备注 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `@notification-width` | `width` | - |
|
||||||
|
| `@notification-padding` | `notificationPadding` | - |
|
||||||
|
| `@notification-padding-vertical` | `notificationPaddingVertical` | - |
|
||||||
|
| `@notification-padding-horizontal` | `notificationPaddingHorizontal` | - |
|
||||||
|
| `@notification-margin-bottom` | `notificationMarginBottom` | - |
|
||||||
|
| `@notification-margin-edge` | `notificationMarginEdge` | - |
|
||||||
|
| `@notification-bg` | `notificationBg` | - |
|
||||||
|
|
||||||
<!-- ### Pagination 分页 -->
|
<!-- ### Pagination 分页 -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user