Browse Source

fix(button): Button block prop not working (#38869)

pull/38877/head
jjlstruggle 2 years ago
committed by GitHub
parent
commit
c4c2ee7e32
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      components/button/style/index.tsx

18
components/button/style/index.tsx

@ -46,10 +46,6 @@ const genSharedButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token): CSS
marginInlineStart: token.marginXS, marginInlineStart: token.marginXS,
}, },
[`&${componentCls}-block`]: {
width: '100%',
},
'&:not(:disabled)': { '&:not(:disabled)': {
...genFocusStyle(token), ...genFocusStyle(token),
}, },
@ -463,6 +459,17 @@ const genSizeLargeButtonStyle: GenerateStyle<ButtonToken> = (token) => {
return genSizeButtonStyle(largeToken, `${token.componentCls}-lg`); return genSizeButtonStyle(largeToken, `${token.componentCls}-lg`);
}; };
const genBlockButtonStyle: GenerateStyle<ButtonToken> = (token) => {
const { componentCls } = token;
return {
[componentCls]: {
[`&${componentCls}-block`]: {
width: '100%',
},
},
};
};
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Button', (token) => { export default genComponentStyleHook('Button', (token) => {
const { controlTmpOutline, paddingContentHorizontal } = token; const { controlTmpOutline, paddingContentHorizontal } = token;
@ -481,6 +488,9 @@ export default genComponentStyleHook('Button', (token) => {
genSizeBaseButtonStyle(buttonToken), genSizeBaseButtonStyle(buttonToken),
genSizeLargeButtonStyle(buttonToken), genSizeLargeButtonStyle(buttonToken),
// Block
genBlockButtonStyle(buttonToken),
// Group (type, ghost, danger, disabled, loading) // Group (type, ghost, danger, disabled, loading)
genTypeButtonStyle(buttonToken), genTypeButtonStyle(buttonToken),

Loading…
Cancel
Save