From c4c2ee7e322f7d1d0a2206efaa3b6a6cdc4312f9 Mon Sep 17 00:00:00 2001 From: jjlstruggle <73511098+jjlstruggle@users.noreply.github.com> Date: Tue, 22 Nov 2022 23:25:25 +0800 Subject: [PATCH] fix(button): Button block prop not working (#38869) --- components/button/style/index.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/components/button/style/index.tsx b/components/button/style/index.tsx index 1eb847f739..5ad03d9b2d 100644 --- a/components/button/style/index.tsx +++ b/components/button/style/index.tsx @@ -46,10 +46,6 @@ const genSharedButtonStyle: GenerateStyle = (token): CSS marginInlineStart: token.marginXS, }, - [`&${componentCls}-block`]: { - width: '100%', - }, - '&:not(:disabled)': { ...genFocusStyle(token), }, @@ -463,6 +459,17 @@ const genSizeLargeButtonStyle: GenerateStyle = (token) => { return genSizeButtonStyle(largeToken, `${token.componentCls}-lg`); }; +const genBlockButtonStyle: GenerateStyle = (token) => { + const { componentCls } = token; + return { + [componentCls]: { + [`&${componentCls}-block`]: { + width: '100%', + }, + }, + }; +}; + // ============================== Export ============================== export default genComponentStyleHook('Button', (token) => { const { controlTmpOutline, paddingContentHorizontal } = token; @@ -481,6 +488,9 @@ export default genComponentStyleHook('Button', (token) => { genSizeBaseButtonStyle(buttonToken), genSizeLargeButtonStyle(buttonToken), + // Block + genBlockButtonStyle(buttonToken), + // Group (type, ghost, danger, disabled, loading) genTypeButtonStyle(buttonToken),