mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix: ant- prefix default set font family & size (#37541)
* fix: missing global font size * chore: patch fontsize * chore: clean up
This commit is contained in:
parent
9293d1043a
commit
b24e9ef846
@ -15,6 +15,7 @@ export const resetComponent = (token: DerivativeToken): CSSObject => ({
|
||||
lineHeight: token.lineHeight,
|
||||
listStyle: 'none',
|
||||
// font-feature-settings: @font-feature-settings-base;
|
||||
fontFamily: token.fontFamily,
|
||||
});
|
||||
|
||||
export const resetIcon = (): CSSObject => ({
|
||||
@ -96,6 +97,17 @@ export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
|
||||
},
|
||||
});
|
||||
|
||||
export const genFontStyle = (token: DerivativeToken, rootPrefixCls: string) => {
|
||||
const { fontFamily, fontSize } = token;
|
||||
|
||||
return {
|
||||
[`[class^="${rootPrefixCls}-"], [class*=" ${rootPrefixCls}-"]`]: {
|
||||
fontFamily,
|
||||
fontSize,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const genFocusOutline = (token: DerivativeToken): CSSObject => ({
|
||||
outline: `${token.lineWidth * 4}px solid ${token.colorPrimaryBorder}`,
|
||||
outlineOffset: 1,
|
||||
|
@ -2,7 +2,7 @@
|
||||
import type { CSSInterpolation } from '@ant-design/cssinjs';
|
||||
import { useStyleRegister } from '@ant-design/cssinjs';
|
||||
import { useContext } from 'react';
|
||||
import { genLinkStyle } from '../../style';
|
||||
import { genFontStyle, genLinkStyle } from '../../style';
|
||||
import { ConfigContext } from '../../config-provider/context';
|
||||
import type { UseComponentStyleResult } from '../index';
|
||||
import { mergeToken, statisticToken, useToken } from '../index';
|
||||
@ -61,9 +61,13 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
|
||||
}
|
||||
|
||||
// Generate style for all a tags in antd component.
|
||||
useStyleRegister({ theme, token, hashId, path: ['Link'] }, () => ({
|
||||
'&': genLinkStyle(token),
|
||||
}));
|
||||
useStyleRegister({ theme, token, hashId, path: ['Shared', rootPrefixCls] }, () => [
|
||||
{
|
||||
// Link
|
||||
'&': genLinkStyle(token),
|
||||
},
|
||||
genFontStyle(token, rootPrefixCls),
|
||||
]);
|
||||
|
||||
return [
|
||||
useStyleRegister(
|
||||
|
Loading…
Reference in New Issue
Block a user