mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
fix: Input.Search large size button style (#48527)
* fix: Input.Search large size button style * chore: adjust logic * chore: rename
This commit is contained in:
parent
5fbca4afa9
commit
f77302553d
@ -881,4 +881,7 @@ export default genStyleHooks(
|
||||
];
|
||||
},
|
||||
initComponentToken,
|
||||
{
|
||||
resetFont: false,
|
||||
},
|
||||
);
|
||||
|
@ -107,29 +107,34 @@ export const genCommonStyle = (
|
||||
token: DerivativeToken,
|
||||
componentPrefixCls: string,
|
||||
rootCls?: string,
|
||||
resetFont?: boolean,
|
||||
): CSSObject => {
|
||||
const { fontFamily, fontSize } = token;
|
||||
|
||||
const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
|
||||
const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector;
|
||||
|
||||
const resetStyle: CSSObject = {
|
||||
boxSizing: 'border-box',
|
||||
|
||||
'&::before, &::after': {
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
};
|
||||
|
||||
let resetFontStyle: CSSObject = {};
|
||||
|
||||
if (resetFont !== false) {
|
||||
resetFontStyle = {
|
||||
fontFamily: token.fontFamily,
|
||||
fontSize: token.fontSize,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
[rootPrefixSelector]: {
|
||||
fontFamily,
|
||||
fontSize,
|
||||
boxSizing: 'border-box',
|
||||
...resetFontStyle,
|
||||
...resetStyle,
|
||||
|
||||
'&::before, &::after': {
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
|
||||
[prefixSelector]: {
|
||||
boxSizing: 'border-box',
|
||||
|
||||
'&::before, &::after': {
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
},
|
||||
[prefixSelector]: resetStyle,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -133,6 +133,7 @@ export default function genComponentStyleHook<C extends OverrideComponent>(
|
||||
getDefaultToken?: GetDefaultToken<C>,
|
||||
options: {
|
||||
resetStyle?: boolean;
|
||||
resetFont?: boolean;
|
||||
// Deprecated token key map [["oldTokenKey", "newTokenKey"], ["oldTokenKey", "newTokenKey"]]
|
||||
deprecatedTokens?: [ComponentTokenKey<C>, ComponentTokenKey<C>][];
|
||||
/**
|
||||
@ -243,7 +244,9 @@ export default function genComponentStyleHook<C extends OverrideComponent>(
|
||||
});
|
||||
flush(component, componentToken);
|
||||
return [
|
||||
options.resetStyle === false ? null : genCommonStyle(mergedToken, prefixCls, rootCls),
|
||||
options.resetStyle === false
|
||||
? null
|
||||
: genCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont),
|
||||
styleInterpolation,
|
||||
];
|
||||
},
|
||||
@ -378,6 +381,7 @@ export const genStyleHooks = <C extends OverrideComponent>(
|
||||
getDefaultToken?: GetDefaultToken<C>,
|
||||
options?: {
|
||||
resetStyle?: boolean;
|
||||
resetFont?: boolean;
|
||||
deprecatedTokens?: [ComponentTokenKey<C>, ComponentTokenKey<C>][];
|
||||
/**
|
||||
* Component tokens that do not need unit.
|
||||
|
Loading…
Reference in New Issue
Block a user