mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
feat: Button support buttonFontWeight (#42121)
This commit is contained in:
parent
4a4eae5221
commit
4cf6f1b83b
@ -7,7 +7,9 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||
import genGroupStyle from './group';
|
||||
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {}
|
||||
export interface ComponentToken {
|
||||
buttonFontWeight: number;
|
||||
}
|
||||
|
||||
export interface ButtonToken extends FullToken<'Button'> {
|
||||
colorOutlineDefault: string;
|
||||
@ -17,14 +19,14 @@ export interface ButtonToken extends FullToken<'Button'> {
|
||||
|
||||
// ============================== Shared ==============================
|
||||
const genSharedButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token): CSSObject => {
|
||||
const { componentCls, iconCls } = token;
|
||||
const { componentCls, iconCls, buttonFontWeight } = token;
|
||||
|
||||
return {
|
||||
[componentCls]: {
|
||||
outline: 'none',
|
||||
position: 'relative',
|
||||
display: 'inline-block',
|
||||
fontWeight: 400,
|
||||
fontWeight: buttonFontWeight,
|
||||
whiteSpace: 'nowrap',
|
||||
textAlign: 'center',
|
||||
backgroundImage: 'none',
|
||||
@ -502,35 +504,41 @@ const genBlockButtonStyle: GenerateStyle<ButtonToken> = (token) => {
|
||||
};
|
||||
|
||||
// ============================== Export ==============================
|
||||
export default genComponentStyleHook('Button', (token) => {
|
||||
const { controlTmpOutline, paddingContentHorizontal } = token;
|
||||
export default genComponentStyleHook(
|
||||
'Button',
|
||||
(token) => {
|
||||
const { controlTmpOutline, paddingContentHorizontal } = token;
|
||||
|
||||
const buttonToken = mergeToken<ButtonToken>(token, {
|
||||
colorOutlineDefault: controlTmpOutline,
|
||||
buttonPaddingHorizontal: paddingContentHorizontal,
|
||||
buttonIconOnlyFontSize: token.fontSizeLG,
|
||||
});
|
||||
const buttonToken = mergeToken<ButtonToken>(token, {
|
||||
colorOutlineDefault: controlTmpOutline,
|
||||
buttonPaddingHorizontal: paddingContentHorizontal,
|
||||
buttonIconOnlyFontSize: token.fontSizeLG,
|
||||
});
|
||||
|
||||
return [
|
||||
// Shared
|
||||
genSharedButtonStyle(buttonToken),
|
||||
return [
|
||||
// Shared
|
||||
genSharedButtonStyle(buttonToken),
|
||||
|
||||
// Size
|
||||
genSizeSmallButtonStyle(buttonToken),
|
||||
genSizeBaseButtonStyle(buttonToken),
|
||||
genSizeLargeButtonStyle(buttonToken),
|
||||
// Size
|
||||
genSizeSmallButtonStyle(buttonToken),
|
||||
genSizeBaseButtonStyle(buttonToken),
|
||||
genSizeLargeButtonStyle(buttonToken),
|
||||
|
||||
// Block
|
||||
genBlockButtonStyle(buttonToken),
|
||||
// Block
|
||||
genBlockButtonStyle(buttonToken),
|
||||
|
||||
// Group (type, ghost, danger, disabled, loading)
|
||||
genTypeButtonStyle(buttonToken),
|
||||
// Group (type, ghost, danger, disabled, loading)
|
||||
genTypeButtonStyle(buttonToken),
|
||||
|
||||
// Button Group
|
||||
genGroupStyle(buttonToken),
|
||||
// Button Group
|
||||
genGroupStyle(buttonToken),
|
||||
|
||||
// Space Compact
|
||||
genCompactItemStyle(token),
|
||||
genCompactItemVerticalStyle(token),
|
||||
];
|
||||
});
|
||||
// Space Compact
|
||||
genCompactItemStyle(token),
|
||||
genCompactItemVerticalStyle(token),
|
||||
];
|
||||
},
|
||||
{
|
||||
buttonFontWeight: 400,
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user