mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 08:59:15 +08:00
36 lines
951 B
TypeScript
36 lines
951 B
TypeScript
import { theme } from 'antd';
|
|
import { useContext } from 'react';
|
|
import { ConfigContext } from 'antd/es/config-provider';
|
|
|
|
const { useToken } = theme;
|
|
|
|
const useSiteToken = () => {
|
|
const result = useToken();
|
|
const { getPrefixCls, iconPrefixCls } = useContext(ConfigContext);
|
|
const rootPrefixCls = getPrefixCls();
|
|
const { token } = result;
|
|
const siteMarkdownCodeBg = token.colorFillTertiary;
|
|
|
|
return {
|
|
...result,
|
|
token: {
|
|
...token,
|
|
headerHeight: 64,
|
|
menuItemBorder: 2,
|
|
mobileMaxWidth: 767.99,
|
|
siteMarkdownCodeBg,
|
|
antCls: `.${rootPrefixCls}`,
|
|
iconCls: `.${iconPrefixCls}`,
|
|
/** 56 */
|
|
marginFarXS: (token.marginXXL / 6) * 7,
|
|
/** 80 */
|
|
marginFarSM: (token.marginXXL / 3) * 5,
|
|
/** 96 */
|
|
marginFar: token.marginXXL * 2,
|
|
codeFamily: `'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,
|
|
},
|
|
};
|
|
};
|
|
|
|
export default useSiteToken;
|