fix: font-family for components (#39806)

* fix: font-family for components

* chore: code clean
This commit is contained in:
MadCcc 2022-12-26 16:08:42 +08:00 committed by GitHub
parent 663d1454f2
commit c1390b20a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -103,11 +103,15 @@ export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
}, },
}); });
export const genCommonStyle = (componentPrefixCls: string): CSSObject => { export const genCommonStyle = (token: DerivativeToken, componentPrefixCls: string): CSSObject => {
const { fontFamily, fontSize } = token;
const rootPrefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`; const rootPrefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
return { return {
[rootPrefixSelector]: { [rootPrefixSelector]: {
fontFamily,
fontSize,
boxSizing: 'border-box', boxSizing: 'border-box',
'&::before, &::after': { '&::before, &::after': {

View File

@ -87,7 +87,7 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
overrideComponentToken: token[component], overrideComponentToken: token[component],
}); });
flush(component, mergedComponentToken); flush(component, mergedComponentToken);
return [genCommonStyle(prefixCls), styleInterpolation]; return [genCommonStyle(token, prefixCls), styleInterpolation];
}, },
), ),
hashId, hashId,