From 5e4e9970dcb76f6404dff367f96ed9abdf0e8a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Thu, 4 May 2023 15:38:07 +0800 Subject: [PATCH] feat: migrate less to token for Drawer (#42084) --- components/drawer/style/index.ts | 12 +++++------- docs/react/migrate-less-variables.en-US.md | 15 ++++++++++++++- docs/react/migrate-less-variables.zh-CN.md | 15 ++++++++++++++- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/components/drawer/style/index.ts b/components/drawer/style/index.ts index 9eefd07a52..3fe3db3d5c 100644 --- a/components/drawer/style/index.ts +++ b/components/drawer/style/index.ts @@ -4,13 +4,12 @@ import genMotionStyle from './motion'; export interface ComponentToken { zIndexPopup: number; -} - -export interface DrawerToken extends FullToken<'Drawer'> { drawerFooterPaddingVertical: number; drawerFooterPaddingHorizontal: number; } +export interface DrawerToken extends FullToken<'Drawer'> {} + // =============================== Base =============================== const genDrawerStyle: GenerateStyle = (token: DrawerToken) => { const { @@ -217,14 +216,13 @@ const genDrawerStyle: GenerateStyle = (token: DrawerToken) => { export default genComponentStyleHook( 'Drawer', (token) => { - const drawerToken = mergeToken(token, { - drawerFooterPaddingVertical: token.paddingXS, - drawerFooterPaddingHorizontal: token.padding, - }); + const drawerToken = mergeToken(token, {}); return [genDrawerStyle(drawerToken), genMotionStyle(drawerToken)]; }, (token) => ({ zIndexPopup: token.zIndexPopupBase, + drawerFooterPaddingVertical: token.paddingXS, + drawerFooterPaddingHorizontal: token.padding, }), ); diff --git a/docs/react/migrate-less-variables.en-US.md b/docs/react/migrate-less-variables.en-US.md index 31ab040e78..3ce291870b 100644 --- a/docs/react/migrate-less-variables.en-US.md +++ b/docs/react/migrate-less-variables.en-US.md @@ -39,7 +39,20 @@ This document contains the correspondence between all the less variables related - + +## Drawer + + +| Less variables | Component Token | Note | +| --- | --- | --- | +| `@drawer-bg` | `colorBgElevated` | - | +| `@drawer-header-padding` | `padding`、`paddingLG` | `${padding}px ${paddingLG}px` | +| `@drawer-title-font-size` | `fontSizeLG` | - | +| `@drawer-title-line-height` | `lineHeightLG` | - | +| `@drawer-body-padding` | `paddingLG` | - | +| `@drawer-footer-padding-vertical` | `drawerFooterPaddingVertical` | `drawerFooterPaddingVertical` is a number without units, `@drawer-footer-padding-vertical` with units | +| `@drawer-footer-padding-horizontal` | `drawerFooterPaddingHorizontal` | `drawerFooterPaddingHorizontal` is a number without units, `@drawer-footer-padding-horizontal` with units | + diff --git a/docs/react/migrate-less-variables.zh-CN.md b/docs/react/migrate-less-variables.zh-CN.md index 647d2df0c6..abc6bf20ae 100644 --- a/docs/react/migrate-less-variables.zh-CN.md +++ b/docs/react/migrate-less-variables.zh-CN.md @@ -39,7 +39,20 @@ title: Less 变量迁移 Design Token - + +## Drawer 抽屉 + + +| Less 变量 | Component Token | 备注 | +| --- | --- | --- | +| `@drawer-bg` | `colorBgElevated` | - | +| `@drawer-header-padding` | `padding`、`paddingLG` | `${padding}px ${paddingLG}px` | +| `@drawer-title-font-size` | `fontSizeLG` | - | +| `@drawer-title-line-height` | `lineHeightLG` | - | +| `@drawer-body-padding` | `paddingLG` | - | +| `@drawer-footer-padding-vertical` | `drawerFooterPaddingVertical` | `drawerFooterPaddingVertical` 为数字,不带单位,`@drawer-footer-padding-vertical` 带单位 | +| `@drawer-footer-padding-horizontal` | `drawerFooterPaddingHorizontal` | `drawerFooterPaddingHorizontal` 为数字,不带单位,`@drawer-footer-padding-horizontal` 带单位 | +